in reply to Re: More efficient way to exclude footers
in thread More efficient way to exclude footers
Why not, but if the file is very large you're doing a $linecount incrementation and a test for every line in the file.while(<INPUT>) { $linecount++ ; next if $linecount <= $numHeaders; # ... }
is just reading the first $numHeaders lines of the file and throws them away, and you don't add any overhead for the rest of your file. And, BTW, the $. special variable contains the line count of the last read file handle, so that you don't need the $linecount incrementation.<INPUT> for 1..$numHeaders;
|
|---|