In Operators§
See primary documentation in context for infix .=.
Calls the right-side method on the value in the left-side container, replacing the resulting value in the left-side container.
In most cases, this behaves identically to postfix .=
, but the precedence is lower:
my $a = -5; say ++$a.=abs; # with postfix mutator; equivalent to ++($a.=abs) # OUTPUT: «6»
my $a = -5; say ++$a .= abs; # with infix mutator; evaluated as -4 .= abs # OUTPUT: «Cannot modify an immutable Int (-4) # in block <unit> at <tmp> line 1»