in reply to Idiom for a regex translation
If you find it ugly, hide it in a subroutine.
In this case, do something like
which you can later use assub replace (&$) { local $_ = $_[1]; &{$_[0]}(); $_; }
which does not change $oldstr.$newstr = replace { s/k/w/ } $oldstr;
Also, you can find similar functionality in the Sed cpan module.
|
|---|