I'm not sure how this benchmarks, but it is a little more succinct ;-)
use Tie::File; my $length = shift @ARGV; my $file = shift @ARGV; tie(my @file, "Tie::File", $file, autochomp => 0) or die("ack - $!"); print @file[$#file - $length + 1 .. $#file];
_________
broquaint

Update: fixed slice code as it was off by one (as noted by grinder)


In reply to Re: Performing a tail(1) in Perl (reading the last N lines of a file) by broquaint
in thread Performing a tail(1) in Perl (reading the last N lines of a file) by grinder

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":