in reply to comparison of two arrays
Hi lax,
What you have tried so far? I can see this is your first post, so Welcome to the Monastery! Make yourself at home.. Before posting question, please do Super Search. Here is one way to do it.
use strict; use warnings; use List::Compare::Functional qw(:originals :aliases); my @array1 = ('anu','abu','ali'); my @array2 = ('anu','abu', 'ali'); my @c = get_complement( [ \@array1, \@array2 ] ); #data present in the + @array2 but not present in @array1 (@c) ? print "mismatch, return (0)\n" : print "no mismatch here\n"; # +return here itself if mismatch in first array my @d = get_unique( [ \@array1, \@array2 ] ); #data present in the @ar +ray1 but not present in @array2 (@d) ? print "mismatch, return (0)\n" : print "no mismatch in both ar +rays\n"; #return if mismatch
updated: rodion++, thanks :)
Prasad
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: comparison of two arrays
by rodion (Chaplain) on Jun 16, 2006 at 11:19 UTC |