Perl Arithmetic Operators



Assume variable $a holds 10 and variable $b holds 20, then following are the Perl arithmetic operators −

Sr.No. Operator & Description
1 + ( Addition )
Adds values on either side of the operator
Example− $a + $b will give 30
2 - (Subtraction)
Subtracts right-hand operand from the left-hand operand
Example− $a - $b will give -10
3 * (Multiplication)
Multiplies values on either side of the operator
Example− $a * $b will give 200
4 / (Division)
Divides left-hand operand by right-hand operand
Example− $b / $a will give 2
5 % (Modulus)
Divides left-hand operand by right-hand operand and returns the remainder
Example− $b % $a will give 0
6 ** (Exponent)
Performs exponential (power) calculation on operators
Example− $a**$b will give 10 to the power 20
Updated on: 2019-11-29T06:10:13+05:30

209 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements