in reply to matching + character in a file
Please have a look at all the answers you got at matching the + character. In short do either of these:
$var1 = quotemeta $var1; # do this before you use it in the regex or if ($line =~ /\Q$var1\E/m)
Either of these escape all regex metachars and should be considered mandatory if you want to avoid problems interpolating variables into regexes. PS Don't do both at the same time - it is either or!
cheers
tachyon
print quotemeta 'a+b';
|
|---|