I have two arrays, @a and @b. I want to do a compare among the elements of the two arrays.
@a
@b
my @a = qw\"abc def efg ghy klm ghn\"; m
From the requirement that 'if any element matches', use the intersection of sets:
sub set{ my %set = map { $_, undef }, @_; return sort keys %set; } sub compare{ my ($listA,$listB) = @_; return ( (set(@$listA)-set(@$listB)) > 0) }