|
2.7 Summary of Scalar Operators
In this chapter, we have looked at a number of different scalar
operators available in the Perl language. Earlier, we gave a small
chart of the operators, ordered by their precedence. Now that we have
seen all these operators, we should consider a list of them again,
ordered by precedence. Note that some operators are listed as
"nonassoc". This means that the given operator is not associative.
In other words, it simply does not make sense to consider associative
evaluation of the given operator.
Operator | Associativity | Description |
@operator{++}, @operator{--} | nonassoc | auto-increment and auto-decrement |
@operator{**} | right | exponentiation |
@operator{*}, @operator{/}, @operator{%} | left | multiplication, division, modulus |
@operator{+}, @operator{-}, @operator{.} | left | addition, subtraction, concatenation |
@operator{<}, @operator{>}, @operator{<=}, @operator{>=}, @operator{lt}, @operator{gt}, @operator{le}, @operator{ge} | nonassoc | comparison operators |
@operator{==}, @operator{!=}, @operator{<=>}, @operator{eq}, @operator{ne}, @operator{cmp} | nonassoc | comparison operators |
This list is actually still quite incomplete, as we will learn more
operators later on. However, you can always find a full list of all
operators in Perl in the perlop documentation page, which you can
get to on most systems with Perl installed by typing `perldoc
perlop'.
|
|