Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Re: what's this loo code? (*slurp*)

by jmcnamara (Monsignor)
on Feb 04, 2003 at 23:58 UTC ( #232684=note: print w/ replies, xml ) Need Help??


in reply to Re: what's this loo code? (*slurp*)
in thread what's this loo code?


But I wanted to mention my first impression when I saw that code in jmcnamara's node: "Oh, that takes way too much memory and will fail for files that don't fit within your available swap space".

I hope you realise that I was aware of that. :-)

This snippet's only real value is as a mild curiosity. When I first posted it here I wrote: "There are many ways of doing this and most of them are better".

If I really wanted a line count I would use one of the following in this order of preference:

wc -l file awk 'END{print NR}' file perl -nle 'END{print $.}' file
--
John.


Comment on Re: Re: what's this loo code? (*slurp*)
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (10)
As of 2015-07-04 15:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (60 votes), past polls