Help for this page
@list = sort { @$a <=> @$b || do { my $cmp; ($cmp = $a->[-$_] cmp $b->[-$_]) ? last : next for 1 .. @$a; $cmp; } } @list;
#!/usr/bin/env perl ... use Data::Dump; dd \@list;
[ ["one"], ... ["zzz", "def", "ghi"], ["blah", "asdf", "foo", "bar"], ]
#!/usr/bin/env perl ... sub cmp_alpha { $_[0] cmp $_[1] } sub cmp_num { $_[0] <=> $_[1] }
[ ["one"], ... ] [[1], [2], [7, 8, 1], [5, 3, 6], [9, 3, 6], [0 .. 3]] [[2], [1], [9, 3, 6], [5, 3, 6], [7, 8, 1], [0 .. 3]]
www.com | www.net | www.org
No recent polls found