Prev: Simple question about CGI response after form data has been processed.
Next: Syntax with Set-Cookie
From: Mike on 13 Oct 2009 21:59 Does anyone have some simple code to give all the permutations of an array of symbols? i.e. for two symbols in an array: my @array = ('howard', 'geek'); my @permutations = &permute(@array); print join(' ', $permutations[0]), "\n"; print join(' ', $permutations[1]), "\n"; howard geek geek howard It looks easy for two symbols. What about three, four, or more? Mike perl 5.8+
From: J�rgen Exner on 13 Oct 2009 22:19 Mike <mikee(a)mikee.ath.cx> wrote: >Does anyone have some simple code to give all the permutations of >an array of symbols? Anything wrong the answer to "perldoc -q permute"? jue
From: Mike on 13 Oct 2009 22:26 On 2009-10-14, J�rgen Exner <jurgenex(a)hotmail.com> wrote: > Mike <mikee(a)mikee.ath.cx> wrote: >>Does anyone have some simple code to give all the permutations of >>an array of symbols? > > Anything wrong the answer to "perldoc -q permute"? > > jue I had found that, yes, thanks. Sure enough, after posting the question I find an acceptable answer. The tsc_permute looks more simple. <http://docstore.mik.ua/orelly/perl/cookbook/ch04_20.htm> Mike
|
Pages: 1 Prev: Simple question about CGI response after form data has been processed. Next: Syntax with Set-Cookie |