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:
Updated: Added rant, as per tye :)
To make a regex treat $attempt1 as a string, use \Q and \E:
man perlre for more info.$data =~ s/\Q$attempt1\E/$newstr/
Updated: Added rant, as per tye :)
In Section
Seekers of Perl Wisdom