left << >>
nonassoc named unary operators
nonassoc < > <= >= lt gt le ge
- nonassoc == != <=> eq ne cmp
+ nonassoc == != <=> eq ne cmp ~~
left &
left | ^
left &&
concatenated with the identifier is returned. Otherwise, if the string
starts with a plus or minus, a string starting with the opposite sign
is returned. One effect of these rules is that -bareword is equivalent
-to the string "-bareword".
+to the string "-bareword". If, however, the string begins with a
+non-alphabetic character (exluding "+" or "-"), Perl will attempt to convert
+the string to a numeric and the arithmetic negation is performed. If the
+string cannot be cleanly converted to a numeric, Perl will give the warning
+B<Argument "the string" isn't numeric in negation (-) at ...>.
X<-> X<negation, arithmetic>
Unary "~" performs bitwise negation, i.e., 1's complement. For
argument.
X<cmp>
+Binary "~~" does a smart match between its arguments. Smart matching
+is described in L<perlsyn/"Smart Matching in Detail">.
+This operator is only available if you enable the "~~" feature:
+see L<feature> for more information.
+X<~~>
+
"lt", "le", "ge", "gt" and "cmp" use the collation (sort) order specified
by the current locale if C<use locale> is in effect. See L<perllocale>.
=head2 Assignment Operators
X<assignment> X<operator, assignment> X<=> X<**=> X<+=> X<*=> X<&=>
-X<<< <<= >>> X<&&=> X<-=> X</=> X<|=> X<<< >>= >>> X<||=> X<.=>
+X<<< <<= >>> X<&&=> X<-=> X</=> X<|=> X<<< >>= >>> X<||=> X<//=> X<.=>
X<%=> X<^=> X<x=>
"=" is the ordinary assignment operator.
The following are recognized:
**= += *= &= <<= &&=
- -= /= |= >>= ||=
- .= %= ^=
+ -= /= |= >>= ||=
+ .= %= ^= //=
x=
Although these are grouped by family, they all have the precedence
a B<numeric> bitwise operation. You may explicitly show which type of
operation you intend by using C<""> or C<0+>, as in the examples below.
- $foo = 150 | 105 ; # yields 255 (0x96 | 0x69 is 0xFF)
- $foo = '150' | 105 ; # yields 255
+ $foo = 150 | 105; # yields 255 (0x96 | 0x69 is 0xFF)
+ $foo = '150' | 105; # yields 255
$foo = 150 | '105'; # yields 255
$foo = '150' | '105'; # yields string '155' (under ASCII)