in reply to N Permutations of M Items
$_=shift||"ciolnaot"; my $s = join'?',(sort split//),""; while( <> ){ chomp; next unless length == 4; my $t=join'',sort split//; print "$_\n" if $t=~/^$s$/; }
In Section
Seekers of Perl Wisdom
in reply to N Permutations of M Items
$_=shift||"ciolnaot"; my $s = join'?',(sort split//),""; while( <> ){ chomp; next unless length == 4; my $t=join'',sort split//; print "$_\n" if $t=~/^$s$/; }