"\Q" and "\E" are your friends
$tmp =~ /\Q$path\E/Added BTW, I wonder if your $path variable is even defined all the time. Perhaps you should check for that first: $result = defined $path and $tmp =~ /\Q$path\E/;
Added xmath had a great insight that you should be using index() here instead. So that becomes (assuming $tmp is always defined as well) $result = defined $path and -1 != index $tmp, $path;.
In reply to Re: Regexp question
by diotalevi
in thread Regexp question
by hotshot
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |