#!/usr/local/bin/perl use strict; use warnings; my %hash = ( '1' => 22, '2' => 66, '3' => 11); my @keys = sort { $a cmp $b } keys %hash; foreach my $key ( @keys ) { printf "%-20s %6d\n", $key, $hash{$key}; }