I think an insertion sort using splice might work
Homework Spoiler -
use Modern::Perl;
use Smart::Comments;
my %jetsons = (
7 => 'Judy',
10 => 'Jane',
11 => 'George',
2 => 'Elroy',
100=> 'Rosey',
1 => 'Astro',
19 => 'Mr. Spacely',
22 => 'Mr. Cogswell');
my @result = ();
for my $key ( keys %jetsons ){
my $x = 0;
CHECKLIST: for my $value ( @result ){
if( $value > $key ){
last CHECKLIST;
}else{
$x++;
}
}
splice( @result, $x, 0, $key );
}
### @result
Returns
### @result: [
### 1,
### 2,
### 7,
### 10,
### 11,
### 19,
### 22,
### 100
### ]