Home : Perl : Scalars : Number operators
Highest precedence
( expression) |
parentheses |
variable++ ++ variablevariable -- -- variable |
increment the variable after using its
value increment the variable and then use its new value decrement the variable after using its value decrement the variable and then use its new value |
value ** value |
exponentiation |
! value~ value- value+ value |
logical (Boolean) NOT bitwise NOT (one's complement) unary minus (arithmetic negation) unary plus |
value * valuevalue / valuevalue % value |
multiplication division modulus (the remainder from a division) |
value + valuevalue - value |
addition subtraction |
value << countvalue >> count |
shift the value left by the number of bits in
count shift the value right by the number of bits in count |
value < valuevalue > valuevalue <= valuevalue >= value |
less than (returns true or false) greater than (returns true or false) less than or equal (returns true or false) greater than or equal (returns true or false) |
value == valuevalue != valuevalue <=> value |
equal (returns true or false) not equal (returns true or false) comparison (returns -1, 0, +1) |
value & value |
bitwise AND |
value | valuevalue ^ value |
bitwise OR bitwise XOR |
value &&
value |
logical (Boolean) AND |
value || value |
logical (Boolean) OR |
exprA ? exprB :
exprC |
if exprA is true, then evaluate exprB and return its value, else evaluate exprC and return its value |
variable = expressionvariable op= expression |
assign the value of the expression to the
variable, and return that value equivalent to variable = variable op expression, where op is one of * / % + - << >> &
^ | |
exprA, exprB |
evaluate exprA, then evaluate exprB and return its value |
not value |
logical (Boolean) NOT |
value and value |
logical (Boolean) AND |
value or valuevalue xor value |
logical (Boolean) OR logical (Boolean) XOR |
Lowest precedence