Skip to content

Instantly share code, notes, and snippets.

@colomon
Created September 21, 2012 19:54
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 colomon/3763534 to your computer and use it in GitHub Desktop.
Save colomon/3763534 to your computer and use it in GitHub Desktop.
if $a ~~ Hash {
my $keys = set $a.keys, $b.keys;
say $keys.perl;
my @keys = $keys.keys.sort;
for @keys -> $k {
return Order::Decrease unless $a{$k} :exists;
return Order::Increase unless $b{$k} :exists;
(my $r = $a{$k} cmp $b{$k}) && return $r;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment