Help for this page

Select Code to Download


  1. or download this
    my %hash = (
       foo => 2,
    ...
    );
    
    my @array = sort {$hash{$a} <=> $hash{$b}} keys %hash;
    
  2. or download this
    my @array_of_hashes;
    push @array_of_hashes, "$hash{$_} => $_\n" for @array;
    
  3. or download this
    use Data::Dumper;
    print Dumper(\@array_of_hashes);
    
  4. or download this
    $VAR1 = [
              '1 => bar',
    ...
              '2 => foo',
              '3 => baz'
            ];