use strict; my $var1 = "a+b"; my $var2 = "a\+b"; if ($var1 =~ /$var2/) { print "hey it matches \n"; } print "hey here \n";