Have hash of hashes need to loop through and add values of 'month' total values and day+week total values of all except for 'Sum'.
my $month_total = 0; my $day_week_total = 0; $VAR1 = { 'Adam' => { 'days' => 22, 'weeks' => 5, 'total' => 22 }, 'Keas' => { 'total' => 114, 'test' => 2, 'weeks' => 8, 'days' => 107, 'months' => 5 }, 'Tim' => { 'total' => 4, 'weeks' => 5, 'days' => 3, 'months' => 1 }, 'Sum' => { 'total' => 440, 'days' => 365, 'months' => 9 } };
Loop through the hash of hashes and add all the 'months' value except for the key 'Sum'. $month_total = 6 ( none for 'Adam' + 5 for 'Keas' + 1 for 'Tim' ) Loop through the hash of hashes and add all the values of 'days'+'weeks' except for the key 'Sum'. $day_week_total = 150 ( (22+5) for 'Adam' + (107+8) for 'Keas' + (3+5) for 'Tim' )
Expected output: $month_total = 6; $day_week_total = 150;
Dear Monks, please give me a direction to achieve this. Thank you so much
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |