Richard (>): > use v6; > > my %players; > my $scores = open('./skaters.txt', :r) or die $!; > for =$scores { > my ($name,@list) = .split /\,/; > %players{$name} = ([+] @list.sort[2..6]) / 5; > }; > > my @ranking = %players.sort: { .value }; > for <Gold Silver Bronze> -> $m { > given pop @ranking { > say "$m Medal: {$_.key}, {$_.value}"; > }; > };
Nice. A few notes: * Parsefail at line 6. Should have parens around the regex '/\,/'. * You don't need semicolons after line-ending braces '}'. * Consider using .fmt instead of lines 12-14: say (pop @ranking).fmt("$m Medal: %s, %s"); Ta-da! That's 11 lines of code, 35% shorter than the Perl 5 solution. // Carl