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


in reply to Quickie Question: search and replace problem

Basically, $data is intepreted as a string, and $attempt1 as a regex, so if you have special regex characters, they will never match up, no matter how you escape them.

To make a regex treat $attempt1 as a string, use \Q and \E:
$data =~ s/\Q$attempt1\E/$newstr/
man perlre for more info.

Updated: Added rant, as per tye :)