in reply to Regexp question
"\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;.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Regexp question
by nothingmuch (Priest) on Mar 30, 2003 at 15:28 UTC |