http://www.perlmonks.org?node_id=1001957


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