March 2001
Intermediate to advanced
288 pages
4h 56m
English
Perl has a complicated precedence ordering; it helps to be able to look it up quickly (fortunately, it's the first thing out of perldoc perlop). We reproduce that table here (Table 4-1) because we'll be referring to it.
| Associativity | Operators |
|---|---|
| Left | Terms and list operators (leftward) |
| Left | -> |
| Nonassoc | ++ -- |
| Right | ** |
| Right | ! ~ \ and unary + and - |
| Left | =~ !~ |
| Left | * / % x |
| Left | + - . |
| Left | << >> |
| Nonassoc | Named unary and file test operators |
| Nonassoc | < > <= >= lt gt le ge |
| Nonassoc | == != <=> eq ne cmp |
| Left | & |
| Left | | ^ |
| Left | && |
| Left | || |
| Nonassoc | .. … |
| Right | ?: |
| Right | = op= |
| Left | , => |
| Nonassoc | List operators (rightward) |
| Right | not |
| Left | and |
| Left | or xor |
Associativity tells you ...