# Operators Perl’s operator inventory is large but the structure is regular. Operators group into a handful of families — arithmetic, comparison, logical, bitwise, regex binding, assignment — and a few one-off mechanisms (range, ternary, comma, arrow, subscripts). This reference is split into one page per family. PetaPerl implements the full Perl 5 operator set with identical semantics: same precedence, same associativity, same context rules. Differences are localised to the *PetaPerl-specific notes* at the bottom of each page where they apply. ## Choose a family * [Arithmetic operators](perlop/arithmetic.md) * [String operators](perlop/string.md) * [Numeric comparison operators](perlop/numeric-comparison.md) * [String comparison operators](perlop/string-comparison.md) * [Logical operators](perlop/logical.md) * [Bitwise operators](perlop/bitwise.md) * [Range and flip-flop operators](perlop/range.md) * [Regex binding operators](perlop/binding.md) * [Assignment operators](perlop/assignment.md) * [Ternary operator](perlop/ternary.md) * [Subscript and slice operators](perlop/subscript.md) * [Arrow operator](perlop/arrow.md) * [Comma operators](perlop/comma.md) * [Precedence](perlop/precedence.md) - [Arithmetic](perlop/arithmetic.md) — `+ - * / % **` and the unary `+`/`-`. - [String](perlop/string.md) — `.` (concatenation), `x` (repetition). - [Numeric comparison](perlop/numeric-comparison.md) — `< <= == >= > != <=>`. - [String comparison](perlop/string-comparison.md) — `lt le eq ge gt ne cmp` (lexicographic). - [Logical](perlop/logical.md) — `&& || // ! and or not xor` and the short-circuit / operand-return rule. - [Bitwise](perlop/bitwise.md) — `& | ^ ~ << >>`. - [Range](perlop/range.md) — `..` and `...`, with their list/scalar dual semantics. - [Binding](perlop/binding.md) — `=~` and `!~` connect strings with regex. - [Assignment](perlop/assignment.md) — `=` and the compound forms (`+= .= ||= //=` etc.). - [Ternary](perlop/ternary.md) — `?:`. - [Subscript](perlop/subscript.md) — `[]`, `{}`, slices, deref braces. - [Arrow](perlop/arrow.md) — `->` (deref, method call). - [Comma](perlop/comma.md) — `,` and the fat comma `=>`. - [Precedence](perlop/precedence.md) — the full precedence table and the named-unary parse rule that confuses everyone the first time. ## Cross-cutting concepts A few ideas appear in every chapter. Read these once and you will recognise them throughout the rest: - **Context.** Operators evaluate their operands in a specific context (numeric, string, list, scalar, boolean). Many of the surprises in Perl arithmetic and comparison come from context coercion at the operand boundary, not from the operator itself. - **Short-circuit.** `&&`, `||`, `//`, `and`, `or` evaluate left-to-right and stop as soon as the result is determined. The whole expression’s value is the last thing actually evaluated — which is one of its operands, not a normalised true/false. See [logical](perlop/logical.md) and the [boolean-logic tutorial](../../tutorial/boolean-logic/operators.md). - **Precedence.** Tells you how operators bind when parentheses do not. The full table is in [precedence](perlop/precedence.md) and every page links the rows it cares about. - **Lvalue.** Most operators produce *rvalues* (values you can read). A few — assignment, deref, ternary in some shapes — produce *lvalues* (locations you can write to). ## See also - [Boolean Logic for Perl Programmers](../../tutorial/boolean-logic/index.md) — the conceptual companion to the [logical](perlop/logical.md) and [bitwise](perlop/bitwise.md) pages. - [Regular expressions guide](../../guide/regular-expression/index.md) — paired with [binding](perlop/binding.md). - [perlfunc](perlfunc.md) — built-in functions, including every name listed in the [precedence](perlop/precedence.md) page’s *named unary operators* section.