Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: match two files

by Corion (Patriarch)
on Jun 03, 2020 at 09:11 UTC ( [id://11117635]=note: print w/replies, xml ) Need Help??


in reply to match two files

This is a FAQ. See perlfaq4 on How do I compute the intersection of two arrays?.

Your code is slow because for every item in @lines1 it looks at all items in @lines2. If you precompute a lookup table ("hash", in Perl data structures) for the items in @lines2, you can find the items in @lines2 much faster.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2024-04-25 10:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found