Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: optimal way of comparing 2 arrays

by chester (Hermit)
on Oct 19, 2005 at 19:57 UTC ( [id://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;

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2024-04-25 04:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found