http://www.perlmonks.org?node_id=772445


in reply to comparing two array

I like List::Compare for things like this. From the docs:
use strict; use warnings; use List::Compare; my @Llist = qw(abel abel baker camera delta edward fargo golfer) +; my @Rlist = qw( baker camera delta delta edward fargo golfer +hilton); my $lc = List::Compare->new(\@Llist, \@Rlist); my @intersection = $lc->get_intersection; print join ", ", @intersection; # Results: # baker, camera, delta, edward, fargo, golfer
Of course, either of those two lists could consist of only one item.

Cheers,

Brent

-- Yeah, I'm a Delt.