Perl Arithmetic Operators



Assume variable aholds10andvariableb holds 20, then following are the Perl arithmetic operators −

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

232 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements