![]() |
|
go ahead... be a heretic | |
PerlMonks |
Re: regular expressions with !by Tomte (Priest) |
on Sep 14, 2006 at 14:34 UTC ( #572932=note: print w/replies, xml ) | Need Help?? |
You're a victim of operator precedence - the ! has higher precedence than =~ - so your expression evaluates as if ((!$test_string)=~/$regex/), which is false. Either use !~, as already suggested, or use parenthesis around the whole match if (!($test_string =~/$regex/)). You do not need to use the /e modifier!
regards,
An intellectual is someone whose mind watches itself.
In Section
Seekers of Perl Wisdom
|
|