in reply to How do I find the total number of lines in a file?

Try:
open(FILE, "filename"); @lines = <FILE>; close(FILE); $num = @lines;

--newbie00

Replies are listed 'Best First'.
Re: Answer: How do I find the total number of lines in a file?
by jlf (Scribe) on Jan 01, 2002 at 02:12 UTC
    @lines could get rather large depending on the size of the file; how about
    open(FILE, "filename") or die "couldn't open filename: $!"; # check re +turn status of system calls! for ($count = 0; <FILE>; $count++) {}
    Josh