use strict; my %hash=("frog"=>"green", "camel"=>"camel_coloured", "flea"=>"who_knows"); for (my $i=0,my @array=sort keys %hash; $i < 2 ; $i++) { print "Key $i: $array[$i]\n"; }