You are getting the error in line 61 because the denominator is zero, and division by zero is not defined (see the "Proof that 2 = 1" for example).
The fix is to either:
- Check the denominator and skip the calculation if you are going to have a divide-by-zero.
- Debug the code and determine why $total_mono{$k} is not getting updated like you think it ought to be.
----
I Go Back to Sleep, Now.
OGB