From: Mike on
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
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
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