A couple of small points, so small, in fact, that I hesitate to mention them... Ah, what the heck...
-
The command-line parameter capture statements of the form
my $header_lines = $ARGV[0] // 0;
could be written
my $header_lines = $ARGV[0] || 0;
(logical-or || instead of // defined-or) to make the statements Perl version-agnostic (defined-or not introduced until version 5.10). All the rest of the code seems to require nothing more than version 5.0.0. (Tested under 5.8.9.)
-
The while-loop line processing code
push @lines, parse_line($_);
print shift @lines if @lines > $footer_lines;
could be written
push @lines, $_;
print parse_line(shift @lines) if @lines > $footer_lines;
to avoid parsing footer lines (although they still would be read). I have to admit that with only a dozen footer lines to deal with, it's hard to imagine this would make any detectable difference, but if line parsing is extremely expensive... Who knows? (This change also tested.)
Anyway, my two cents, maybe I'll squeeze some XP outta it.
Give a man a fish: <%-{-{-{-<