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