in reply to comparing elements of two arrays

I've always found it useful to print out my values surrounded by square braces when faced with similar problems. In any case, it'll definitely tell you if you need a chomp or not (as was suggested earlier). It also has the added side effect of showing you both values as seen by the comparison in the 'if'. Maybe something like this:
if ($array2[2] eq $array1[2]){ print "$array[2]\n"; } else { print "\n\n[$array2[2]] [$array1[2]]\n\n"; }