http://qs321.pair.com?node_id=139769

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

There must be a long-established idiomatic and elegant perl way to do this -- that I haven't found. I need a statement like:
s/\b$old\b/$new/g;
where $new properly reflects the case of the first letter of $old.

Given $old="my"; $new="no"; this would transmogrify

My perl is my life.
into
No perl is no life.
(I can't include patterns in $new.)

thanks much -
Andy