in reply to Misunderstood array behavior

The other Usual Suspect in a split situation is a trailing split character in the input string, possibly with whitespace after it.

E.g., if one of the strings you are splitting looks like "foo\tbar\tbaz\t" (note the trailing \t at the end), then you will have an empty string as the final string in the split output array.

The other suggestion I would make would be to lose the confusing code construct

while(<$fileText>){ chomp; if($count++ == 0){ # I will eventually read the whole file... @firstLine1 = split(/\t/); last; } }
in favor of something like
chomp($_ = <$file_handle>); # read, chomp one line my @split_fields = split /\t/;
and eventually read the whole file separately.