操作符的次序︰ |
| 操作符 | 描述 | | ++, -- | 自增,自減 | | -, ~, ! | 單目 | | ** | 乘方 | | =~, !~ | 模式匹配 | | *, /, %, x | 乘,除,取餘,重複 | | +, -, . | 加,減,聯接 | | <<, >> | 移位 | | -e, -r, etc. | 文件狀態 | | <, <=, >, >=, lt, le, gt, ge | 不等比較 | | ==, !=, <=>, eq, ne, cmp | 相等比較 | | & | 位與 | | |, ^ | 位或,位異或 | | && | 邏輯與 | | || | 邏輯或 | | .. | 列表範圍 | | ? and : | 條件操作符 | | =, +=, -=, *=, | 賦值 | | and so on | | | , | 逗號操作符 | | not | Low-precedence logical NOT | | and | Low-precedence logical AND | | or, xor | Low-precedence logical OR and XOR |
操作符結合性(associativity)︰ |
| 操作符 | 結合性 | | ++, -- | 無 | | -, ~, ! | Right-to-left | | ** | Right-to-left | | =~, !~ | Left-to-right | | *, /, %, x | Left-to-right | | +, -, . | Left-to-right | | <<, >> | Left-to-right | | -e, -r, | 無 | | <, <=, >, >=, lt, le, gt, ge | Left-to-right | | ==, !=, <=>, eq, ne, cmp | Left-to-right | | & | Left-to-right | | |, ^ | Left-to-right | | && | Left-to-right | | || | Left-to-right | | .. | Left-to-right | | ? and : | Right-to-left | | =, +=, -=, *=, | Right-to-left | | and so on | | | , | Left-to-right | | not | Left-to-right | | and | Left-to-right | | or, xor | Left-to-right | 邏輯或︰$a || $b 或 $a or $b 邏輯與︰$a && $b 或 $a and $b 邏輯非︰! $a 或 not $a 邏輯異或︰$a xor $b |