in reply to Numeric sorting WITHOUT <=>
Here is one bad way to do it! No comparisons at all.
use strict; use warnings; my %jetsons = ( 7 => 'Judy', 10 => 'Jane', 11 => 'George', 2 => 'Elroy', 100=> 'Rosey', 1 => 'Astro', 19 => 'Mr. Spacely', 22 => 'Mr. Cogswell' ); for my $i (0..100) { print "$i => $jetsons{$i}\n" if exists $jetsons{$i}; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Numeric sorting WITHOUT <=>
by Anonymous Monk on Oct 10, 2012 at 03:48 UTC | |
|
Re^2: Numeric sorting WITHOUT <=>
by Marshall (Canon) on Oct 10, 2012 at 04:05 UTC |