in reply to comparing two array
I like List::Compare for things like this. From the docs:
Of course, either of those two lists could consist of only one item.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
Cheers,
Brent
-- Yeah, I'm a Delt.
|
---|
In Section
Seekers of Perl Wisdom