Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re: Using += in array context

by Henri Icarus (Beadle)
on Jun 05, 2001 at 17:53 UTC ( #85809=note: print w/replies, xml ) Need Help??

in reply to Using += in array context

Take a look at this node where esentially the same question is being asked. Especially usefull to you might be this discussion on mapcar

Replies are listed 'Best First'.
(tye)Re: Using += in array context
by tye (Sage) on Jun 05, 2001 at 18:32 UTC

    Personally, I'd use the foreach code from the original question. I find it clearer and cleaner than even the "wish" code. For one thing, "@fields" doesn't have to be repeated in that code.

    If grinder finds     $totals{$_} += $delta{$_} foreach( @fields ); "ugly", then I doubt

    use mapcar; mapcar { $_[0] += $_[1] } [@totals{@fields}], [@delta{@fields}];
    would fair any better.

            - tye (but my friends call me "Tye")

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2023-02-07 11:16 GMT
Find Nodes?
    Voting Booth?
    I prefer not to run the latest version of Perl because:

    Results (39 votes). Check out past polls.