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


in reply to Forcing array context on a file handle

Did you check perldoc? This is a FAQ

perldoc -q "How do I count the number of lines in a file"