Help for this page

Select Code to Download


  1. or download this
    use strict;
    my %foo = (1 => 'value1',2 => 'value2',3 => 'value3');
    
  2. or download this
    print "$foo{$_}\n" foreach sort {$a <=> $b} keys %foo;
    
  3. or download this
    sub sort_hash {
      my %hash = @_;
    ...
    
    my %foo_sorted = sort_hash(%foo);
    print "$foo_sorted{$_}\n" foreach keys %foo_sorted;