in reply to matching + character in a file

See quotemeta:
$var1 = quotemeta($var1); ...etc.