Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^2: matching elements in a list in a logical OR fashion

by meetraz (Hermit)
on Jun 15, 2004 at 04:03 UTC ( [id://366763]=note: print w/replies, xml ) Need Help??


in reply to Re: matching elements in a list in a logical OR fashion
in thread matching elements in a list in a logical OR fashion

This might be even faster, depending on what's in @array...
Regex::Presuf works wonders, and /o usually helps too.

use strict; use Regex::PreSuf; my @array = qw( foo bar baz ); my $re = presuf(@array); my $bigstring = 'whatever'; if ($bigstring =~ /$re/o) { print "it matched"; }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://366763]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2024-03-29 09:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found