in reply to Simple hash problem
However, merlyn's answer shines in its KISSiness, so you're best off going with his solution.use strict; my %hash=("frog"=>"green", "camel"=>"camel_coloured", "flea"=>"who_kno +ws"); for (my $i=0,my @array=sort keys %hash; $i < 2 ; $i++) { print "Key $i: $array[$i]\n"; }
CU
Robartes-
Update: Changed code snippet so it actually demonstrates the point made.
|
|---|