http://www.perlmonks.org?node_id=87398


in reply to 0 illegal modulus?

well, you could override the modulus operator if you prefer, and use an idiom like

$ans = ($y*1) ? $x % $y : 0;
see overload for details.

.