I know that the + is a special metacharacter, and have even tried making $var2 = "a\+b" but for some reason this doesnt work for me either. The only thing that works is when i have 2 forward slashes before the + character like this. $var2 = "a\\+b"; I cannot figure out a logical reason for this. Please if anyone can help me, This is actually a part of a bigger program that is failing when it sees the + character Warisuse strict; my $var1 = "a+b"; my $var2 = "a+b"; if ($var1 =~ /$var2/) { print "hey it matches \n"; } print "hey here \n";
In reply to matching the + character by jalebie
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |