Help for this page
my $regex = '(' . join('|', sort { length $b <=> length $a } keys %tr) . ')'; $str =~ s=$regex=$tr{$1} // $1=ge;