http://qs321.pair.com?node_id=73666


in reply to (tye)Re: Quickie Question: search and replace problem
in thread Quickie Question: search and replace problem

All these do the escaping properly. But the code went like this:
$data = $attempt; $data =~ s/$attempt/$newstr/;
The problem isn't simply bad escaping. Either $attempt gets munged, and the match fails, or you have to premunge $data to get $attempt right, and the match still fails.

So /\Q$attempt\E/ really is the best way to go.