Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

More Sorted Business with Hashes

by Spenser (Friar)
on Dec 22, 2001 at 05:12 UTC ( [id://133925] : perlquestion . print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
         sort keys %hash;
    
  2. or download this
         @keys = sort{$hash{$b} <=> $hash{$a}} keys %hash;
    
  3. or download this
         tie %clients, 'Tie::SortHash', \%clients, $sortblock;
    
         my $sortblock = q(my $c = (split /\s+/, $a)[1];
         my $d = (split /\s+/, $b)[1];
         $c cmp $d || $clients{$a} <=> $clients{$b});
    
  4. or download this
         print $q->scrolling_list(-name=>'acct_num', 
                                  -values=> [keys %clients], 
                                  -labels=> \%clients);