Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I want the output of @minus.But is is showing the array c. Single file contains element :1,2,3,4 Single1 file contains element :1,5,6,7 Ideally the output should be:2,3,4. plz help me.use Array::Utils qw(:all); $file = 'single.txt'; open(FILE,$file); @array= <FILE>; #print @array; $file1='single1.txt'; open(FILE1,$file1); @array1=<FILE1>; @d=@array1; @c=@array; print @d; print @c; # symmetric difference @diff = array_diff(@a, @b); # intersection @isect = intersect(@c, @d); #print @isect; # unique union @unique = unique(@a, @b); #print @unique; # check if arrays contain same members if ( !array_diff(@a, @b) ) { # do something } # get items from array @a that are not in array @b @minus = array_minus( @c,@d ); print "\n difference"; print @minus;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: querybregarding array utils module in perl
by tangent (Parson) on Jun 26, 2014 at 15:31 UTC | |
|
Re: querybregarding array utils module in perl
by kennethk (Abbot) on Jun 26, 2014 at 15:33 UTC |