more useful options | |
PerlMonks |
How to loop through hash of hashes and add the values based on condition?by Sami_R (Sexton) |
on Jan 06, 2020 at 16:20 UTC ( [id://11111061]=perlquestion: print w/replies, xml ) | Need Help?? |
Sami_R has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks,
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'.
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
Back to
Seekers of Perl Wisdom
|
|