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... :-)