sub comp_arr { @arr1=sort($_[0]); @arr2=sort($_[1]); # To check if the number of elements in both arrays match if ($#arr1 != $#arr2) { print "Indicator and anchor count do not match"; exit; } #Actual compare starts here for ($x=0; $x <= $#arr2; $x++) { if ($arr2[$x] ne $arr1[$x]) { print ("Anchor/indicator mismatch in $arr1[$x]\n"); } }