Skip to content

Instantly share code, notes, and snippets.

@tateisu
Created March 13, 2017 06:58
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 tateisu/91283efbdaf1fbddd557a62780554ed8 to your computer and use it in GitHub Desktop.
Save tateisu/91283efbdaf1fbddd557a62780554ed8 to your computer and use it in GitHub Desktop.
@list = sort {
my $i;
$i= $a->a cmp $b->a; $i and return $i;
$i= $a->b cmp $b->b; $i and return $i;
$i= $a->c cmp $b->c; $i and return $i;
return 0;
} @list;
@tateisu
Copy link
Author

tateisu commented Mar 13, 2017

sort {
my $i= $a->a cmp $b->a;
$i or $i= $a->b cmp $b->b;
$i or $i= $a->c cmp $b->c;
return $i;
} @list;

@tateisu
Copy link
Author

tateisu commented Mar 13, 2017

sort { ($a->a cmp $b->a) || ($a->b cmp $b->b) || ($a->c cmp $b->c) } @list

@tateisu
Copy link
Author

tateisu commented Mar 13, 2017

sort { $a->a cmp $b->a or $a->b cmp $b->b or $a->c cmp $b->c} @list

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment