in reply to How to substitute a string containing "\" with same string in quotes.
$string =~ s/\Q$substring\E/\"$substring\"/gi;
\Q..\E uses quotemeta to convert the substring into a regexp pattern that matches the substring.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to substitute a string containing "\" with same string in quotes.
by Anonymous Monk on Oct 24, 2008 at 09:53 UTC |