I don't think we can give a solid answer without knowing better what @p contains. If @p is empty or is a new variable ("use strict"), then the first time through the loop while ( $x % $p[$i] != 0 ) could report a "use of undefined in modulus" because $p[$i] is undefined.
-xdg
Code posted by xdg on PerlMonks is public domain. It has no warranties, express or implied. Posted code may not have been tested. Use at your own risk.
In reply to Re: Modulus zero error
by xdg
in thread Modulus zero error
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |