Documentation for postfix .&

Documentation for postfix .&, assembled from the following types:

language documentation Operators

From Operators

(Operators) postfix .&

The operator to call a subroutine (with at least one positional argument) like a method. The invocant will be bound to the first positional argument.

Technically this is not an operator, but syntax special-cased in the compiler.

my sub f($invocant){ dd $invocant}
my $i = 42;
42.&f;
# OUTPUT: «Int $invocant = 42␤» 
42.&(-> $invocant { dd $invocant });
# OUTPUT: «Int $invocant = 42␤»