in reply to Quoting metacharacters in regexen

I have written the following demo program but was delayed for almost an hour because I had to attend the Monday morning's manager's meeting. Anyway, I will post it here anyway, since no monks have shown you a search and replace example yet. :-)
use strict; my $string = '+5^7'; my $line = '((1+2)-4)*(2+5^7)'; # insert \ in front of pattern $line =~ s/(\Q$string\E)/\\$1/; print "$line\n";
Basically you use \Q and \E to quote meta characters, or use the 'quotemeta' function.

And the output is -
((1+2)-4)*(2\+5^7)