Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Grep lines from a text file, compare to an array using regex?

by choroba (Cardinal)
on Jun 08, 2014 at 21:04 UTC ( [id://1089212]=note: print w/replies, xml ) Need Help??


in reply to Grep lines from a text file, compare to an array using regex?

You can convert it to a problem you already know how to solve by just creating one large regular expression from all the lines you want to search for.
my $pattern = join '|', map quotemeta, @lines; $pattern = qr/^(?:$pattern)$/;
لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Log In?
Username:
Password:

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

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

    No recent polls found