in reply to confused with summing certain elements from an array

A hash is not sorted, by definition. You can sort the keys when you print it, though.
my %counts; for (0 ... $#out){ $counts{$out[$_]} += $out1[$_]; }
should build the hash.

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
    Looks ambiguous to me. "For array iterator array1 points to scalar var and count var, increment hash at var by count" if I had never seen perl 6 code before.