http://qs321.pair.com?node_id=572932


in reply to regular expressions with !

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,
tomte


An intellectual is someone whose mind watches itself.
-- Albert Camus

Replies are listed 'Best First'.
Re^2: regular expressions with !
by svenXY (Deacon) on Sep 14, 2006 at 15:07 UTC
    Hi,
    thanks Tomte++! The only explanation that helped me understnad the problem right away!
    Regards,
    svenXY