in reply to Re: Sorting integer value hash keys
in thread Sorting integer value hash keys
or, if you don't need a name and like the 0 values:my %statistics; undef @statistics{ 1..10 }; # or @statistics{ 1..10 } = (0) x 10 say join "\n", sort { $a <=> $b } keys %statistics;
say join "\n", sort { $a <=> $b } keys %{{ map { $_ => 0 } 1..10 }}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Sorting integer value hash keys
by ikegami (Patriarch) on Dec 25, 2009 at 19:25 UTC | |
by JadeNB (Chaplain) on Dec 25, 2009 at 19:41 UTC | |
by ikegami (Patriarch) on Dec 25, 2009 at 20:01 UTC |