All perl operators are documented in the perlop man page.
This page contains:
Multiplicative Operators
Binary "*" multiplies two numbers.
Binary "/" divides two numbers.
Binary "%" computes the modulus of two numbers.
Given integer operands $a and $b: If $b is positive, then "$a % $b" is $a minus the largest multiple of $b that is not greater than $a. If $b is negative, then "$a % $b" is $a minus the smallest multiple of $b that is not less than $a (i.e. the result will be less than or equal to zero). Note than when "use integer" is in scope, "%" gives you direct access to the modulus operator as implemented by your C compiler. This operator is not as well defined for negative operands, but it will execute faster.
Yours, "As soon as we started programming, we found to our surprise that it wasn't as
easy to get programs right as we had thought. Debugging had to be discovered.
I can remember the exact instant when I realized that a large part of my life
from then on was going to be spent in finding mistakes in my own programs."
--Maurice Wilk
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.