in reply to Regexes and backslashes
However, it's also possible that you meant the string to be as it was, in which case maybe you're wanting to reeval that string and therefore turn the escaped characters into their corresponding code like the following:$_ = "Goodbye\\; Good luck\\, and thanks for all the fish!\\\n\\\n"; print "<$_>\n"; s/\\([;,\n])/$+/g; # Does work print "<$_>\n";
$_ = "Goodbye\\; Good luck\\, and thanks for all the fish!\\n\\n"; print qq{<$_>\n}; s/(\\.)/qq{"$1"}/eeg; print qq{<$_>\n};
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Regexes and backslashes
by oko1 (Deacon) on Feb 16, 2011 at 01:47 UTC | |
by AnomalousMonk (Archbishop) on Feb 16, 2011 at 04:08 UTC |