Sporti69 has asked for the wisdom of the Perl Monks concerning the following question:
Super Simple, I suppose ...
The piece of code beneath outputs the keys and values of the hash ... How do I sort this hash so that Number will be printed first ?
my %hash = ( EX => 'ArraySite', AM => 'IOPort', PLE => 'AddressGroup', Number => '11', ); for my $key ( keys %hash ) { my $value = $hash{$key}; print "$key => $value\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Hash Order
by jeffa (Bishop) on Nov 17, 2008 at 19:18 UTC | |
|
Re: Hash Order
by MidLifeXis (Monsignor) on Nov 17, 2008 at 19:08 UTC | |
by bart (Canon) on Nov 18, 2008 at 10:21 UTC | |
|
Re: Hash Order
by ccn (Vicar) on Nov 17, 2008 at 19:01 UTC | |
|
Re: Hash Order
by toolic (Bishop) on Nov 17, 2008 at 19:17 UTC | |
|
Re: Hash Order
by JavaFan (Canon) on Nov 17, 2008 at 19:12 UTC |