in reply to comparing data btwn 2 files

A quick note:
my $flag=1;
You now have 2 variables with the name $flag. That'll probably not do what you want. (Hint: drop the my)

And assuming line 17 is

if ( $arr1[1] eq $arr2[1] && $arr1[2] eq $arr2[2] && $arr1[3] eq $arr2 +[3])
I'm guessing your strings don't actually have 4 tab separated parts (at least for some lines; or perhaps the files don't have the same length).

"4"? Yes, array indexes start at 0, so you're skipping the first array item, with index 0.