[ what was all that? in-line top posting? please don't ]


Hanson, Rob wrote:
Is there a way to determine the number of lines
in a file without actually iterating through the
file and incrementing a file?




# No silver bullet; but shorter -

undef $/; # Slurp;

foreach $target (@ARGV) {
 @lines = ();

 open (HTML_FILE, "<$target") or die "owie";
 @lines = split(/\n/, <HTML_FILE>);

 print "In $target - Seen: ". ($#lines + 1) ." lines...\n";
}

__END__

-Sx-

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to