in reply to nested replace

Just a parenthetic note: From Perl version 5.14 on, the  /r modifier for  s/// and  tr/// operators allows them to return the substituted/transformed string for a slightly simpler expression:

c:\@Work\Perl\monks>perl -wMstrict -le "my $c = qq{foo /* bar \n baz \n boff \n */ fum}; print qq{<<$c>>}; ;; $c =~ s{ /[*] (.*) [*]/ }{ $1 =~ s{[^\n]}{}xmsrg }xmsge; print qq{[[$c]]}; " <<foo /* bar baz boff */ fum>> [[foo fum]]
Works with  $1 =~ tr{\n}{}cdr as well. See  s/// in Regexp Quote-Like Operators, and  tr/// in Quote-Like Operators.


Give a man a fish:  <%-{-{-{-<