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.
In reply to Re: Forcing array context on a file handle
by BrowserUk
in thread Forcing array context on a file handle
by ronmrdechai
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |