Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

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

by hardburn (Abbot)
on Jun 15, 2004 at 13:57 UTC ( [id://366891]=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

For the metacharacters case, how about this:

my $re = do { local $" = '\E|\Q'; qr/\Q@array\E/; };

That lets you ditch the map and array refernceing/dereferencing inside the regex. Though it is arguably not as clear.

----
send money to your kernel via the boot loader.. This and more wisdom available from Markov Hardburn.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://366891]
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 01:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found