in reply to += a hash slice?

You can assign a list to a hash slice, but that's about it. You need another loop:
my %add = ( a => 1, b => 2, c => 3, ); for (1 .. 10) { $totals{$_} += $add{$_} for keys %add; } print Dumper(\%totals);

Or, you use each:

while (my ($k, $v) = each %add) { $totals{$k} += $v; }
لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Replies are listed 'Best First'.
Re^2: += a hash slice?
by Random_Walk (Prior) on Jun 01, 2015 at 13:00 UTC

    Your first suggestion is pretty much the solution I used. It's clear for future maintainers.

    Cheers,
    R.

    Pereant, qui ante nos nostra dixerunt!