Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re^2: Need RegExp help - doing an AND match

by Anonymous Monk
on Jul 01, 2007 at 14:14 UTC ( [id://624306]=note: print w/replies, xml ) Need Help??


in reply to Re: Need RegExp help - doing an AND match
in thread Need RegExp help - doing an AND match

Oh, hang on a second, there was a valid reason why I wanted RegExp, actually, I forgot.

grep will still search the whole array @words, right?

My original code terminates as soon as it fails to match one word in the array which is what I wanted as the file is huge.
Ok, it's not the best code at all, but it doesn't have to search the entire array every time.

I haven't benchmarked to check yet, but I guess grep might take longer.

I was hoping for a RegExp that stopped its search on a mismatch so I think your second solution might be faster, I will check.

Thanks!
  • Comment on Re^2: Need RegExp help - doing an AND match

Replies are listed 'Best First'.
Re^3: Need RegExp help - doing an AND match
by lidden (Curate) on Jul 01, 2007 at 18:08 UTC
    The List::Util module has a first function which may be what you want here instead of grep.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (2)
As of 2024-04-26 01:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found