> -----Original Message-----
> From: ERIC Lawson - x52010 [mailto:[EMAIL PROTECTED]] 
> Sent: Monday, July 30, 2001 11:35 AM
> To: [EMAIL PROTECTED]
> Subject: most efficient way to count lines in a file
> 
> 
> What's the most efficient way to find the total number of 
> lines in a file using perl?
> 
> Now, I'm using 
> 
> while (<FILE>) { ++$lincnt; }

That's OK. This also works:

   perl -ne 'END { print "$.\n" }' foo

$. is line number (see perldoc perlvar)

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

Reply via email to