in reply to Add Array values
but that says "Canīt coerce array into hash at line 13".use strict; use warnings; use Data::Dumper; my %hash = ( one => [ 1, 2, 4 ], two => [ 5, 7, 9 ], ); my @add = ( 7, 8, 15 ); $hash{one} = [ map { $hash{one}{$_} + $add[$_] } (0 .. $#add) ]; print Dumper \%hash;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Add Array values
by injunjoel (Priest) on Dec 29, 2004 at 23:16 UTC |