[thelist] perl: show me the last n lines from this file

Luther, Ron Ron.Luther at COMPAQ.com
Fri May 11 15:48:10 CDT 2001

Hi Sam,

I'm a 'perl-newbie' too ... but I DO have my Cookbook at the office.

Page 282 sez ... "The limitations of file access .... prevent you from
reading a line at a time starting at the end.  You must read the lines into
memory, then process them in reverse order."


Another idea.  I didn't see [in a quick look] any "skip n lines" in a read -
but I guess you could 'roll-your own' ... if you knew your file had roughly
1.1M records ... you could have a loop read in the first 1,000,000 records
and throw them into the "bit bucket" ... then continue reading and do your



-----Original Message-----
From: Sam-I-Am [mailto:dsentelskids at sam-i-am.com]
Subject: [thelist] perl: show me the last n lines from this file

I'm trying to build a page (cgi) that displays the last say 20 access
from the web access-log. (or 5k, or whatever)

More information about the thelist mailing list