in reply to Re: performing a function on corresonding array elements
in thread performing a function on corresonding array elements

Or more beautiful this way:
use List::Util qw(sum); ... for my $href ( @set ) { $totals[ $_ ] += sum @{ $href->{items} } } ...
It makes operations on deeply nested structures a bit more readable.

Replies are listed 'Best First'.
Re^3: performing a function on corresonding array elements
by BrowserUk (Patriarch) on Apr 03, 2006 at 12:39 UTC

    It would be beautiful if it worked--but it does not. Where do you set the value of $_?


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.