in reply to Matching and replacing

One quick and dirty solution would be to ensure that higher (and therefore longer) keys are substituted first.

foreach $key (sort { $b <=> $a } keys %method) { $message_ref->[0] =~ s/$key/$method{$key}/; }
--
<http://www.dave.org.uk>

"The first rule of Perl club is you do not talk about Perl club."
-- Chip Salzenberg