The cookbook recipe here seems to be the quickest:
$count += tr/\n/\n/ while sysread(FILE, $_, 2 ** 16); #assumes line
terminator is "\n"

> -----Original Message-----
> From: Rob [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, October 15, 2002 10:12 AM
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: Re: line count
> 
> 
> Christophe
> 
> Jenda's quite right - you have to count them. The reason 
> being that the
> number of lines in a file is essentially the number of line terminator
> characters in it. You can't count these without reading the 
> whole file in
> some way.
> 
> HTH
> 
> Rob
> 
> ----- Original Message -----
> From: "folschette" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, October 15, 2002 2:55 PM
> Subject: line count
> 
> 
> > hello,
> > is there a veriable holding the total amount of lines of a 
> specific file ?
> > or do I have to count the lines in a loop?
> >
> > christophe folschette
> >
> > --
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to