Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: matching an array of alternates

by takshaka (Friar)
on Jun 24, 2000 at 07:23 UTC ( [id://19698]=note: print w/replies, xml ) Need Help??


in reply to matching an array of alternates

The pipe-joined monolithic regex isn't terribly efficient.

The qr// approach described in perlfaq6 (that is, versions of perlfaq6 that ship with Perl 5.005 or later, but not the one on this site) is much faster.

my @regexes = map { qr/\Q$_/ } @latin_am; while (<>) { for my $regex (@regexes) { if ($_ =~ $regex) { print; last; } } }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (5)
As of 2024-04-19 00:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found