prefix --

Documentation for prefix -- assembled from the following types:

language documentation Operators

From Operators

(Operators) prefix --

multi sub prefix:<-->($x is rwis assoc<non>

Decrements its argument by one and returns the updated value.

my $x = 3;
say --$x;   # OUTPUT: «2␤» 
say $x;     # OUTPUT: «2␤» 

It works by calling the pred method (for predecessor) on its argument, which gives custom types the freedom to implement their own decrement semantics.