Operators
Table 4.3 lists all the Perl operators from highest to lowest precedence and indicates their associativity.
Table 4-3. Perl Associativity and Operators, Listed by Precedence
| Associativity | Operators |
|---|---|
| Left | Terms and list operators (leftward) |
| Left |
-> (method call, dereference) |
| Nonassociative |
++ -- (autoincrement, autodecrement) |
| Right |
** (exponentiation) |
| Right |
|
| Left |
|
| Left |
|
| Left |
|
| Left |
|
| Nonassociative |
Named unary operators and file-test operators |
| Nonassociative |
|
| Nonassociative |
|
| Left |
& (bit-and) |
| Left |
| ^ (bit-or, bit-xor) |
| Left |
&& (logical AND) |
| Left |
|| (logical OR) |
| Nonassociative |
.. … (range) |
| Right |
?: (ternary conditional) |
| Right |
|
| Left |
, => (comma, arrow comma) |
| Nonassociative | List operators (rightward) |
| Right |
not (logical not) |
| Left |
and (logical and) |
| Left |
or xor (logical or, xor) |
You can make your expressions clear by using parentheses to group any part of an expression. Anything in parentheses will be evaluated as a single unit within a larger expression.
With very few exceptions, ...