If you have servers without swap, the following two lines will fail, with failure to devide by zero. There needs to be a check to see if:
if ($mem->{swaptotal} == 0)
and some logic to just set the value to zero, rather than try to divide by it.
Regards,
Chris Frazee