in reply to confused with summing certain elements from an array
should build the hash.my %counts; for (0 ... $#out){ $counts{$out[$_]} += $out1[$_]; }
Update: the Perl 6 solution is much prettier, btw:
for @out Z @out1 -> $char, $count { %hash{$char} += $count; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: confused with summing certain elements from an array
by Zen (Deacon) on Nov 20, 2007 at 14:51 UTC |