To avoid the quotemeta problem and allow a bit more flexibility, it might make sense to use qr// as described in Regexp Quote Like Operators.
my %subs = ( qr/tag1/ => 'subst1', qr/tag2/ => 'subst2', ... ); $str =~ s[$_][$subs{$_}] for keys %subs;
#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.
In reply to Re^2: reg. expr. multiple substitutions
by kennethk
in thread reg. expr. multiple substitutions
by silentius
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |