$ perl -le ' %h = map @$_, map [ $_, 2 * $_ ], 1 .. 3; print qq{$_ - $h{$_}} for sort {$a <=> $b} keys %h;' 1 - 2 2 - 4 3 - 6 $