I have two arrays, @a and @b. I want to do a compare among the elements of the two arrays.
my @a = qw\"abc def efg ghy klm ghn\";
m         
        
Check to create an intersect function, which will return a list of items that are present in both lists. Then your return value is dependent on the number of items in the intersected list.
You can easily find on the web the best implementation of intersect for Perl. I remember looking for it a few years ago.
Here's what I found :
my @array1 = (1, 2, 3);
my @array2 = (2, 3, 4);
my %original = ();
my @isect = ();
map { $original{$_} = 1 } @array1;
@isect = grep { $original{$_} } @array2;