in reply to Re^2: Sorting integer value hash keys
in thread Sorting integer value hash keys
say join "\n", sort { $a <=> $b } keys %{{ map { $_ => 0 } 1..10 }}
Furthermore, since you assume the list is constant, that can be simplified tosay for sort { $a <=> $b } keys %{{ map { $_ => 0 } 1..10 }}
And if you wanted to show that stringification doesn't matter, the following would suffice:say for sort { $a <=> $b } 1..10;
say for sort { $a <=> $b } map "$_", 1..10;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Sorting integer value hash keys
by JadeNB (Chaplain) on Dec 25, 2009 at 19:41 UTC | |
by ikegami (Patriarch) on Dec 25, 2009 at 20:01 UTC |