sub add_hash_slice{ my $slice = shift or return undef; my $hash1 = shift or return undef; my $hash2 = shift or return $hash1; $hash1->{$key} += $hash2->{$key} for my $key( @$slice ); return $hash1; } #call add_hash_slice( \@fields, \%totals, \%delta);