
To an array or hash (or a location capable of holding a hard reference, if Named Unary Operators for more discussion of this.Īlso parsed as terms are the do subscript, then the left side must be either a hard or symbolic reference Probably doesn't do what you expect at first glance. (print $foo), exit # This is what you want. # These do the print before evaluating exit: Print($foo, exit) # Obviously not what you want. # These evaluate exit before doing the print: TERM with regard to the preceding expression. To gobble up all the arguments that follow them, and then act like a simple The commas on the right of the sort are evaluated before the sort, but theĬommas on the left are evaluated after. Left side or the right side of the operator. Print, sort, or chmod is either very high or very low depending on whether you are looking at the In the absence of parentheses, the precedence of list operators such as Is followed by a left parenthesis as the next token, the operator andĪrguments within parentheses are taken to be of highest precedence, just If any list operator (print(), etc.) or any unary operator (chdir(), etc.) In this sense, just list operators and unary operators behaving asįunctions because you put parentheses around the arguments. They includes variables, quoteĪnd quote-like operators, any expression in parentheses, and any function In the following sections, these operators are covered in precedence order.Ī TERM has the highest precedence in Perl. Very few exceptions, these all operate on scalar values only, not array (This makes learning Perl easier for C folks.) With

The same precedence relationship with each other, even where C's precedence Note that all operators borrowed from C keep Perl operators have the following associativity and precedence, listed from
