Operator Precedence and Associativity

Operator precedence determines which operators in a complex expression are evaluated first. Associativity determines how operators that have the same precedence are evaluated (where your choices are left-to-right, right-to-left, or nonassociative for those operators where order of evaluation is either not important, not guaranteed, or not even possible). Table 3.2 shows the precedence and associativity of the various operators available in Perl, with operators of a higher precedence (evaluated first) higher up in the table than those of a lower precedence (evaluated later). You'll want to fold down the corner of this page or mark it with a sticky note; this is one of those tables you'll probably refer to ...

Get Sams Teach Yourself Perl in 21 Days, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.