- or download this
The subroutine for the assignment variant of an operator is
required only to return the result of the operation. It is
permitted to change the value of its operand (this is safe be
+cause
Perl calls the copy constructor first), but this is optional
+since
Perl assigns the returned value to the left-hand operand anyw
+ay.
- or download this
'+=' => sub { $_[0] -> badd($_[1]); },
- or download this
'+=' => sub { $_[0] -> badd($_[1]); 42 },
- or download this
D:\>perl -MDevel::Peek -MMath::BigFloat -le "$x = Math::BigFloat->new(
+20); $x += 100; print $x; Dump $x;"
42
...
PV = 0x1bc9b44fbe0 "42"\0
CUR = 2
LEN = 16