This is one way:
map { s/this/that/; $_ } do { $str };
You can substitute [$str]->[0] for do { $str } if you'd like.
_____________________________________________________
Jeff[japhy]Pinyan:
Perl,
regex,
and perlhacker, who'd like a job (NYC-area)
s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;
Comment on Re: Non-destructive string substitution
Hmm. The debugger runs them differently. Oh well. Regardless, if you don't mind stringification, you can use "$foo" as the argument to map().
_____________________________________________________
Jeff[japhy]Pinyan:
Perl,
regex,
and perlhacker, who'd like a job (NYC-area)
s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;