Assignment
It is important to note that the order in which items appear in this table are arbitrary. All operators have equal precedence to ACL.
Table 4. Expression operators assignment table
=
$i = 1 sets the value of $i to 1.
+=
$i += 2 increases the value of $i by 2. (Same as $i = $i + 2)
-=
$i -= 2 decreases the value of $i by 2. (Same as $i = $i - 2)
*=
$i *= $n increases the value of $i by a factor of the value of $n. (Same as $i = $i * $n)
/=
$i /= 3 divides the value of $i by 3. Note that integer arithmetic is used; thus, if $a=5, the command $a/=3; message "$a" yields 1, not 1.6667. (Same as $i = $i / 3)
%=
$i %= 5 changes the value of $i to the remainder of the value of $i divided by 5. (Same as $i = $i % 5)
.=
$s .= ".pub" concatenates the string .pub to the end of the string represented by $s. (Same as $s = $s . ".pub")
&=
$i &= 7 zeros all but the low order 3 bits of the value of $i. (Same as $i = $i & 7)
|=
$i |= 1 sets the low order bit of the value of $i to 1. (Same as $i = $i | 1)
^=
$i ^= 1 inverts the low order bit of the value of $i. For example, if $i is 5, sets $i to 4. (Same as $i = $i ^ 1)
<<=
$i <<= 2 multiplies the value of $i by 4. (Same as $i = $i << 2)
>>=
$i >>= 2 divides the value of $i by 4. (Same as $i = $i >> 2)
The following operators are numeric and require numeric operands:
+, -, *, /, &, ^, |, <<, >>, %, ~, ++, and ––
Related Topics
Est-ce que cela a été utile ?