@anc=("BX1.01.001","BX1.01.002","BX1.01.003","BX1.01.004","BX1.01.005","BX1.01.006"); @ind=("BX1.01.002","BX1.01.002","BX1.01.003","BX1.01.004","BX1.01.005","BX1.01.006"); #### 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"); } }