in reply to Re: string replacement
in thread string replacement
my $pattern = join "|", map quotemeta, keys %replacements;
I think it would be good to also sort on length, as I discussed in Building Regex Alternations Dynamically. Although huck does make a good point that preserving the original ordering may be important too. Update after your reply: Good point about replacements within the replacements, whether the OP wants that or not and which method is more appropriate will depend on their requirements.
In Section
Seekers of Perl Wisdom