- Perl ›
- Operators ›
- Arithmetic operator ›
- here
Modulo operator "%" - find the remainder
You can use the modulo operator "%" to find the remainder of numbers.
my $num3 = $num1 %$num2;
This is an example to find the remainder of 11 divided by 3.
my $num = 11% 3;
The remainder will be 2.
Explanation of arithmetic operators
The modulo operator is one of the arithmetic operators. For a detailed explanation of arithmetic operators, see the Arithmetic Operators Explanation page.