in reply to Re^2: Forcing array context on a file handle
in thread Forcing array context on a file handle
That works for files in the default case, because every line will have a newline or somesuch, and will not be an empty string. For counting, map would be more appropriate than grep. But tobyink showed the idiom above:
my $lines =()= <$file>;
-QM
--
Quantum Mechanics: The dreams stuff is made of
|
---|
In Section
Seekers of Perl Wisdom