in reply to How do I print the values of a hash, sorted by the hash keys?

my %data = (1 => 'c', 2 => 'b', 3 => 'a'); foreach my $val (@data{sort keys %data}) { print $val . $/; }

Originally posted as a Categorized Answer.