in reply to Re: How to convert a script from C to Perl?
in thread How to convert a script from C to Perl?
Here's one possible solution. No attempt was made to match the order in the generated sequence.
use Algorithm::Combinatorics qw( permutations ); my $iter = permutations( [split //, shift // q(how do you do)] ); while (my $p = $iter->next) { print join q(), @$p, "\n"; }
See Algorithm::Combinatorics for more info and examples.
|
|---|