Help for this page

Select Code to Download


  1. or download this
    sub sort_aoa {
      my( $array, $column ) = @_;
      return sort { $a->[$column] cmp $b->[$column] } @$array;
    }
    
  2. or download this
    sub sort_lines_by_column {
      my( $array, $column ) = @_;
    ...
        return( (split ' ', $a)[$column] cmp (split ' ', $b)[$column] );
      } @$array;
    }