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