Xevo said:
I can not find any information on what the "and equal" operators &=
and &&= do. I looked in the 'Programming Perl' book, searched
perldoc.com, and tried to google it, but to no avail. Can anyone fill
me in on how to use these strange operators?
From perldoc perlop:
Assignment operators work as in C. That is,
$a += 2;
is equivalent to
$a = $a + 2;
although without duplicating any side effects that
dereferencing the lvalue might trigger, such as from tie().
Other assignment operators work similarly. The following
are recognized:
**= += *= &= <<= &&=
-= /= |= >>= ||=
.= %= ^=
x=
All operators of the form OP= have the same expansion form. So $x &= $y
is equivalent to $x = $x & $y, which means to take the bitwise and of
the two values $x and $y, and put the result back in $x. Similarly, $x
&&= $y is equivalent to $x = $x && $y, which means to take the logical
conjunction of the values $x and $y, and put the result back in $x.
Paul Lalli