my $href = { env4 => 20140830, env1 => 20140829, env2 => 20140828, env3 => 20140828, }; print "$_, $href->{$_}\n" for sort { $href->{$b} <=> $href->{$a} } keys %$href; #### my %hash = ( ..... ); print "$_, $hash{$_}\n" for sort { $hash{$b} <=> $hash{$a} } keys %hash;