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

Re: optimal way of comparing 2 arrays

by dragonchild (Archbishop)
on Oct 19, 2005 at 19:49 UTC ( [id://501396]=note: print w/replies, xml ) Need Help??


in reply to optimal way of comparing 2 arrays

You're on the right track, but not quite. You're looking over @file2 once and @file1 twice. You can combine the loops for @file1 into a for-loop and you'll be slightly better off.

Of course, "best" is a difficult word to work with. Personally, I'd use Set and go for the intersection for both and the differences for the ones missing.


My criteria for good software:
  1. Does it work?
  2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (2)
As of 2024-04-25 05:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found