Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^3: Forcing array context on a file handle

by QM (Vicar)
on Nov 02, 2012 at 12:31 UTC ( #1001957=note: print w/ replies, xml ) Need Help??


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


Comment on Re^3: Forcing array context on a file handle
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1001957]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (8)
As of 2014-08-01 08:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (257 votes), past polls