http://www.perlmonks.org?node_id=1049316


in reply to Re^2: Its a pretty simple question.. though embarassed to ask but i am totally new in perl
in thread Its a pretty simple question.. though embarassed to ask but i am totally new in perl

The suggestion was to use next to skip the header line if either you recognize it as a header (for example with a regex), or you know that it is the first line of the file because the $. special variable (line number in the last read file) is equal to 1, something like this:

next if $. == 1;

In my example program, I used a third solution: to read (and discard) one line of input of each file before entering into the while loop. This is slightly faster when reading huge files, since it removes a test from the inner loop, but the difference is probably pretty small.