http://www.perlmonks.org?node_id=121211


in reply to Re: Re: Re:{2} Getting impossible things right (behaviour of keys)
in thread Getting impossible things right (behaviour of keys)

Good, point... the entire sort is unnecessary. The length is taken care of by the regex engine, and its not possible to have two matches of the same length, so no sorting all all is needed. Therefore, I submit that:
my $pattern = join('|',(keys %sufdata)); if ($name =~ s/($pattern)$/$sufdata{$1}/o) { print "Suffix $1 -> $name\n"; return; } print " no rule apply -> $name\n";
Would work the same as my code above.

-Blake