- 论坛徽章:
- 145
|
回复 1# 104359176
1. perldoc perlop
2. 别依赖优先等级...
-------------------------------------------
$ perldoc perlop
NAME
perlop - Perl operators and precedence
...
Perl operators have the following associativity and precedence, listed
from highest precedence to lowest. Operators borrowed from C keep the same
precedence relationship with each other, even where C's precedence is
slightly screwy. (This makes learning Perl easier for C folks.) With very
few exceptions, these all operate on scalar values only, not array values.
left terms and list operators (leftward)
left ->
nonassoc ++ --
right **
right ! ~ \ and unary + and -
left =~ !~
left * / % x
left + - .
left << >>
nonassoc named unary operators
nonassoc < > <= >= lt gt le ge
nonassoc == != <=> eq ne cmp ~~
left &
left | ^
left &&
left || //
nonassoc .. ...
right ?:
right = += -= *= etc.
left , =>
nonassoc list operators (rightward)
right not
left and
left or xor
In the following sections, these operators are covered in precedence
order.
|
|