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


in reply to reg. expr. multiple substitutions

Use a hash and a loop:

my %subs = ( tag1 => 'subst1', tag2 => 'subst2', ... ); $str =~ s[$_][$subs{$_}] for keys %subs;

Depending upon the nature of the text involved, you may need to quotemeta some stuff, but that's the basic idea.

Note however, this is only slightly more compact; it will not be quicker or much easier to maintain.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

The start of some sanity?