http://qs1969.pair.com?node_id=287445

traveler has asked for the wisdom of the Perl Monks concerning the following question:

A recent post to SOPW (which I cannot locate just now) asked how to shorten something like this:
$str = "the boy walked the dog"; $str =~ s/walked/fed/; $str =~ s/boy/girl/; $str =~ s/dog/Audrey II/;
by removing all the $str =~ stuff. There were multiple solutions, but I think the question was really along the lines of why we can't access the matched string easily. That is, whey can't we chain the substitutions? Wouldn't chaining the substutions be nice? Is there a string class that allows this kind of thing? It just seems more perlish to be able to chain the substitutions.

--traveler