Howdy all:

I'm trying to figure out the best way to test a string agains a list of regexs like so:

my @regex = qw(qr(joe$) qr(^mama) qr([abc]));
        
 if($string does not match any of the regexs in @regex) { .... }
So basically
        if($string !~ [EMAIL PROTECTED]) { ... }

I suppose I could do a for() and set a value accordingly and then test against that in 
my if() statement.
I just figured theres a better way to do it than my initial idea.
        my $matches;
        for(@regex) { if($string =~ m/$_/) { $itmatches++; } }
        if(!$itmatches) { .... }

I could always just do

        if($string !~ m/joe$|^mama|[abc]/) { .... }

Just waondering if theres a way to use an actual array in the if statement

TIA

Dan

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to