Skip to content

Instantly share code, notes, and snippets.

@thundergnat
Created January 1, 2020 16:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thundergnat/fadc9a77b9e53d308f13ec0945c43687 to your computer and use it in GitHub Desktop.
Save thundergnat/fadc9a77b9e53d308f13ec0945c43687 to your computer and use it in GitHub Desktop.
my $id = 1;
my %customer = (
$id++ => { :name('aa') :age(9) },
$id++ => { :name('bb') :age(22) },
$id++ => { :name('cc') :age(11) },
);
say 'Sorted by age, descending:';
say "ID# {.key}) Name: {.value<name>}, Age: {.value<age>}"
for %customer.sort( -*.value<age> );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment