in reply to Calculations using values from two different hashes

If you need to sum the values of each subhash, List::Util can help you with that. Then just divide each number by the sum and multiply by 100.
use List::Util qw{ sum }; for my $report (values %counts) { my $sum = sum(values %$report); $_ = sprintf '%.2f', 100 * $_ / $sum for values %$report; }

So, no need for %overallcounts.

($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,

Replies are listed 'Best First'.
Re^2: Calculations using values from two different hashes
by Maire (Scribe) on Nov 25, 2017 at 13:05 UTC
    Thanks for this! I had stumbled upon List::Util in my Googling, but I couldn't work out how to actually incorporate it into my code. Will do some experimenting with this now. Thanks again!