in reply to Hashes - perl
That way, we can help you understand how to do it better.
Update: I did not notice the second level of hash in the OP - see AnomalousMonk's (++) more correct answer below, for 2 levels of hashes.my $total = 0; for my $v ( values %Your_Hash_name ){ $total += $v; } # Can also be written as: # $total += $_ for values %Your_Hash_Name; print "Total: $total\n";
When in doubt, mumble; when in trouble, delegate; when in charge, ponder. -- James H. Boren
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Hashes - perl
by AnomalousMonk (Archbishop) on Oct 19, 2013 at 23:50 UTC |