Well, I have Perl scripts that can chew through a 2 gig log file in a minute or two (the underlying hardware can have a lot to do with it). I think you would have to get pretty darn big before Perl has any practical problem with it.
I would, however, recommend using $. instead of a counter. it's already there, and no need to mess with more code than is necessary. If performance is a big issue, you can use sysopen() and sysread() to read in buffers of an arbitrary size (dependent only on available memory), parse the lines from the buffer and count them manually. This would dramatically reduce the number of disk accesses, but I don't think you'll see much of a difference until you are dealing with hundreds of thousands of lines. Keary Suska Esoteritech, Inc. "Leveraging Open Source for a better Internet" > From: "Adam Russell" <[EMAIL PROTECTED]> > Date: Fri, 11 Jan 2002 12:14:38 -0800 > To: [EMAIL PROTECTED] > Cc: [EMAIL PROTECTED] > Subject: RE: [MacPerl] showing text lines > > Well, if the log file is small enough you can just loop through the file and > increment an index at every pass and that should be good enough for small > logfiles. For large logfiles, especially if you want to look at high numbered > ranges, I wouldn't use perl. In that case I would use our old friend sed. > There is an MPW implementation for sed for per-OSX macs and with OSX you can > use the standard Unix sed. > For sed questions you can e-mail me off list(way too OT, I think>:). > Best Regards, > Adam > >> Date: Fri, 11 Jan 2002 18:58:30 +0100 >> Multi-Graphics <[EMAIL PROTECTED]> macperl <[EMAIL PROTECTED]> [MacPerl] >> showing text lines >> how can i count the numbers of lines text of a log file >> and how do i show the number >> and how can i print for example line 5 to 15 >> >> thanks > > > ------------------------------------------------------------ > PS: You should check out this great new site that I found. They've got free > movies, music, email. It's really great! http://www.netbroadcaster.com >