That's right. Note also that if there are too few fields in a line this simply assigns undef rather than generating an invalid access as your original code did.
If you are sure that the first line contains the header line then you can simply:
$_ = <DATA> or die "Empty file";
chomp;
# Throw away the first two fields (#, username) in the header
(undef, undef, @fields) = (split /\t/);
before the loop.
Perl is Huffman encoded by design.
|