Richard Hainsworth wrote:
> Could someone help me understand what is going on in the following snippet?
> 
> my %players = {'william'=>2, 'peter'=>3,'john'=>1,'mary'=>5};
> my @ranking = %players.sort: { .value };
> for @ranking {.say};
> 
> I cut and pasted from Patrick's blog on sorting and played around  to 
> get an array.
> But ... I dont understand what is being passed to @ranking.
> More precisely, I dont understand the meaning of the ':' after '.sort'

There are three syntaxes for method calls:

$obj.method;    # no args
$obj.method($args);
$obj.method: $args;

The latter is used in the example.

> Where is this behaviour described?

S12, probably.

Cheers,
Moritz

Reply via email to