Help for this page

Select Code to Download


  1. or download this
    @FullSort = sort {$a->[1] cmp $b->[1]
                       ||
                      $a->[0] cmp $b->[0]
                       ||
                      $a->[2] <=> $b->[2]} @data;
    
  2. or download this
    @data = sort { $a->[0] cmp $b->[0] } @data;
    @data = sort { $a->[1] cmp $b->[1] } @data;
    @data = sort { $a->[2] <=> $b->[2] } @data;
    
  3. or download this
    return -1;  # moves the item lower
    return +1;  # goes above the previous one
    return 0;   # equals
    
  4. or download this
    my %speeds = (115kbps => 10,
                  2Mbps => 20,
    ...
                  T1 LINE => 40);
    
    my @sorted = sort { $speeds{$a} <=> $speeds{$b} } @unsorted;