in reply to comparing arrays
In scalar context returns the number of columns that differ (zero if the arrays are the same). In list context returns an list containing the indexes of the columns that differ (an empty list if the arrays are the same).
Array::Compare doesn't look like a fun module. There are a lot of ways to do this though. If you know one array is a superset of another, and if you don't care about possible duplicates in the arrays, you could use a hash like this:
use warnings; use strict; my @array1 = (1,9,2,3,4,8,5); my @array2 = (1, 2,3,4, 5); my %hash; @hash{@array2} = (); foreach my $item (@array1) { print "$item\n" if ! exists $hash{$item}; }
|
|---|