http://qs1969.pair.com?node_id=11134023


in reply to Re^3: Windows and backslashes and replacements oh my!
in thread Windows and backslashes and replacements oh my!

One $bs is sufficient in my tests:

d:\>perl -E"for $x (qw/C:\berrybrew\test C:\berrybrew /) {$_=$x; $bs=c +hr(92); s/berrybrew(?!\\+test)/berrybrew${bs}test/; say}" C:\berrybrew\test C:\berrybrew\test d:\>

> Obviously Perl needs to escape the backslash inside a regex

not after interpolation of variables like $bs

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery