in reply to regular expressions with !

try using 'not' instead of '!', like so:

... if(not $test_string =~ /$regex/) { ... } ...

It's basically a question of operator precedence.

To make your intentions clearer, you should probably use the '!~' operator:

... if($test_string !~ /$regex/) { ... } ...

Replies are listed 'Best First'.
Re^2: regular expressions with !
by ikegami (Patriarch) on Sep 14, 2006 at 14:27 UTC
Re^2: regular expressions with !
by Tomte (Priest) on Sep 14, 2006 at 14:37 UTC

    It is considered good style to mark such a massive edit of a node as you have done here...either strike old content out, or at least leave a note like Edit: ....

    regards,
    tomte


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