I'm not sure how this benchmarks, but it is a little more succinct ;-)It should benchmark OK, although not as well as a special-purpose backward-file-reader. But I agree with you about the succinctness. I mostly followed up to point out that you can do even better:use Tie::File; ... print @file[$#file - $length + 1 .. $#file];
Hope this helps.print @file[-$length .. -1];
--
Mark Dominus
Perl Paraphernalia
In reply to Re: Performing a tail(1) in Perl (reading the last N lines of a file)
by Dominus
in thread Performing a tail(1) in Perl (reading the last N lines of a file)
by grinder
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |