M
Mike
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+
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+