%hash = sort %hash; #### use strict; use warnings; my %hash = ( thing1 => 'one thing', thing2 => 'leads to another', All => 'is great and glorious', ); print "$_ => $hash{$_}\n" for keys %hash; %hash = sort %hash; print "\n"; print "$_ => $hash{$_}\n" for keys %hash; #### thing2 => leads to another All => is great and glorious thing1 => one thing leads to another => one thing thing1 => thing2 All => is great and glorious