in reply to Misunderstood array behavior
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
in favor of something likewhile(<$fileText>){ chomp; if($count++ == 0){ # I will eventually read the whole file... @firstLine1 = split(/\t/); last; } }
and eventually read the whole file separately.chomp($_ = <$file_handle>); # read, chomp one line my @split_fields = split /\t/;
|
|---|