my %subst_for = ( "walked" => "fed", "boy" => "girl", "dog" => "Audrey II" ); $_ = "the boy walked the dog"; my $alt = join '|', map quotemeta, keys %subs; s/($alt)/$subst_for{$1}/g;
Makeshifts last the longest.
In reply to Re^2: Chaining string ops
by Aristotle
in thread Chaining string ops
by traveler
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |