From what I learned in school, modulo is simply defined as:
$rest = $number - ($number/$modulo);
That given, the error is perfectly justified when $module is 0.
According to
PISA german schools are not the among the best anymore, but in this particular case, perl is with me. ;-)
Note: This doesn't take into account that perls modulo is an integer modulo.
Update:
oops. That should of course be (as
ivancho states.):
$rest = $number - (($number/$modulo) * $modulo);
Note to self: Don't post 5 minutes after waking up :-/