Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re: Compare two arrays for uniqueness

by Laurent_R (Abbot)
on Dec 16, 2013 at 07:13 UTC ( #1067294=note: print w/replies, xml ) Need Help??

in reply to Compare two arrays for uniqueness

List::Compare is the way to go; however, assuming you wanted to do it manually yourself, there are two possibilities: to sort the arrays and then compare the elements one by one, or, better in most cases, to store one array in a hash and then check for elements of the other array that are in the hash;

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (13)
As of 2016-10-26 08:30 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (337 votes). Check out past polls.