Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^2: adding a column of integers

by sintadil (Pilgrim)
on Sep 02, 2004 at 18:16 UTC ( [id://388034]=note: print w/replies, xml ) Need Help??


in reply to Re: adding a column of integers
in thread adding a column of integers

Note that this uses map in void context, which is bad except in newer Perls. It's not so horrible for a one-liner, though.

Replies are listed 'Best First'.
Re^3: adding a column of integers
by Anonymous Monk on Sep 02, 2004 at 21:31 UTC
    My, my, my. Another fool who thinks he can appear to be smart by chiming the familiar song about map in void context. And to be really smart he mentions it's not so bad in modern perl.

    Forget about the map. The damage is done before the map is called. Executing <> in list context is slurping in the entire file. You've lost your constant memory solution right there. Regardless of the version of Perl you are using.

Re^3: adding a column of integers
by cog (Parson) on Oct 04, 2004 at 13:35 UTC
    I would use a grep instead of a map... :-)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (8)
As of 2024-03-29 08:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found