in reply to Is this expected behavior for chomp/split...?!

There is an extra character "\n" at the end of the line, this becomes the final element of the array. Change sub count_fields such that my @x = split( /\t+/, $line); to see what I mean. The fact that there are empty elements on the way to the last legitimate element is of no interest, try the following with and without the + modifier on \t in the split.
#!/usr/bin/perl use strict; use warnings; my $line ="A\tB\tC\tD\t\t\t\t\n"; print "Test string line: $line"; print "Split without chomp: "; my @x=count_fields( $line ); check_for_null_elements(@x); print "Split _after_ chomp: "; chomp $line; @x=count_fields( $line ); check_for_null_elements(@x); exit; sub check_for_null_elements { foreach my $element (@_){ print "Empty element found\n" if ($element eq ""); } } sub count_fields { my ($line) = shift; my @x = split( /\t+/, $line); my $count = @x; print "$count fields.\n"; return (@x); }