in reply to Add Array values
What you're finding is that mathematical operators are not overloaded to work on sets. You need something like this:
use strict; use warnings; use Data::Dumper; my %hash = ( one => [ 1, 2, 4 ], two => [ 5, 7, 9 ] ); my @add = ( 7, 8, 15 ); $hash{one}->[$_] += $add[$_] foreach 0 .. $#add; print Dumper \%hash;
Dave
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Add Array values
by debiandude (Scribe) on Dec 29, 2004 at 21:16 UTC |