programming-examples/perl/Basics/OPERATOR PURPOSENumeric operators.pl
2019-11-18 14:44:36 +01:00

51 lines
1.9 KiB
Perl

OPERATOR PURPOSE
+ Computes the additive value of the two operands.
Computes the difference between the two operands.
* Computes the multiplication of the two operands.
/ Computes the division between the two operands.
% Computes the modulus (remainder) of the two operands.
== Returns True if the two operands are equal, False otherwise.
!= Returns True if the two operands are not equal, False otherwise.
>= Greater than.
<= Less than.
>
<=> Returns -1 if the left operand is less than the right, +1 if is it greater than, and 0 (False) otherwise.
&& a logical AND operation.
|| a logical OR operation.
& Returns the value of the two operators bitwise ANDed.
| Returns the value of the two operators bitwise ORed.
~ Returns the value of the two operators bitwise XORed.
++ Increment operator. Increments the variable's value by 1.
-- Decrement operator. Decrements the variable's value by 1.
xx Computes the power of the left value to the power of the right value.
+= Adds the value of the right operand to the value of the left operand.
-= Subtracts the value of the right operand from the value of the left operand.
x= Multiplies the value of the left operand with the value of the right operand.
>> Shifts the left operand right by the number of bits specified by the right operand.
<< Shifts the left operand left by the number of bits specified by the right operand.
~ Performs a 1s complement of the operator. This is a unary operator.