in reply to Looking for a better way to get the number of lines in a file...
10 lines if you don't count the line breaks$file="filename.ext"; open(COUNT,"$file") || err("Oops.. $!"); @lines = <COUNT>; close(COUNT); $count="0"; foreach $line (@lines) { $count++; } print "Content-type: text/html\n\n"; print "$file's length is $count";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Looking for a better way to get the number of lines in a file...
by belden (Friar) on Dec 11, 2001 at 00:21 UTC | |
|
Re: Re: Looking for a better way to get the number of lines in a file...
by Biker (Priest) on Dec 10, 2001 at 22:01 UTC |