Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: optimal way of comparing 2 arrays

by chester (Hermit)
on Oct 19, 2005 at 19:57 UTC ( #501400=note: print w/ replies, xml ) Need Help??


in reply to optimal way of comparing 2 arrays

use warnings; use strict; use List::Compare; use Data::Dumper; my @file1 = qw{1 2 3 4 }; my @file2 = qw{ 2 3 4 5}; my $lc = List::Compare->new( { lists => [\@file1, \@file2], } ); my @intersection = $lc->get_intersection(); my @file1_only = $lc->get_Lonly(); my @file2_only = $lc->get_Ronly(); print Dumper \@intersection, \@file1_only, \@file2_only;


Comment on Re: optimal way of comparing 2 arrays
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2014-09-21 05:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (166 votes), past polls