Help for this page

Select Code to Download


  1. or download this
    
    # tie HASH, 'Tie::SortHash', ANON_HASH, SORT_EXPR
    ...
                                        $d =~ s/\w+\s//;
                                        $c cmp $d || $hash{$b} <=> $hash{$
    +a}
                                       );
    
  2. or download this
    print "$_\t$hash{$_}\n" foreach keys %hash;
    <code>
    ...
    Jim Baker    30
    Jane Doe    39
    John Doe    20
    
  3. or download this
    foreach ( sort keys %hash ) {
    ...
    }
    
  4. or download this
    (tied %hash)->newsortblock( q($b cmp $a) );
    
  5. or download this
    my %people = (
                  'John Doe'   => 25,
    ...
                     );
    
    tie %people, 'Tie::SortHash', { %people }, $sortblock;