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