in reply to Re^2: problem with perl 5
in thread problem with regex in perl script intended for 5.20,but while running on 5.10
It sounds like you've already solved the problem, but for the benefit of others: The /r modifier causes the expression $string=~s/\Q$oldstring\E/$newstring/gsr to return the modified version of $string without changing the content of $string. However, since then you're just assigning that value back to $string, the expression if ($string = $string=~s/\Q$oldstring\E/$newstring/gsr) is equivalent to if ($string=~s/\Q$oldstring\E/$newstring/gs), since without /r, the $string=~s///; expression modifies $string directly.
|
|---|