Help for this page

Select Code to Download


  1. or download this
    @list = sort { @$a <=> @$b || do {
        my $cmp;
        ($cmp = $a->[-$_] cmp $b->[-$_]) ? last : next for 1 .. @$a;
        $cmp;
    } } @list;
    
  2. or download this
    #!/usr/bin/env perl
    
    ...
    
    use Data::Dump;
    dd \@list;
    
  3. or download this
    [
      ["one"],
    ...
      ["zzz", "def", "ghi"],
      ["blah", "asdf", "foo", "bar"],
    ]
    
  4. or download this
    #!/usr/bin/env perl
    
    ...
    
    sub cmp_alpha { $_[0] cmp $_[1] }
    sub cmp_num { $_[0] <=> $_[1] }
    
  5. or download this
    [
      ["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]]