in reply to Forcing array context on a file handle
If there's any chance that the file can be of any real size at all, and you only want the line count, you'd be much better off using:
my $lines; ++$lines while <$file>;
Building a potentially huge list only to throw it away, just to count the lines, will be very costly in terms of time and memory.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Forcing array context on a file handle
by choroba (Cardinal) on Oct 31, 2012 at 01:31 UTC | |
by BrowserUk (Patriarch) on Oct 31, 2012 at 05:40 UTC |