Sort values in a hash : sort « Hash « Perl






Sort values in a hash

    

$hash{fruit} = apple;
$hash{sandwich} = hamburger;
$hash{drink} = bubbly;

foreach $value (sort values %hash) {
    print "$value\n";
}

   
    
    
    
  








Related examples in the same category

1.Hash Value Sorting
2.Numerically Sort a Hash by Values in Ascending Order
3.Numerically Sort a Hash by Values in Descending Order
4.Sort Hash by Keys Numerically
5.Sort Hash by Keys in Reverse Order
6.Sort keys in a hash
7.Sorting a Hash
8.Ordered hash
9.Using customized function to sort keys in a hash