in reply to Printing Output in different way
my %hash2=( a => "apple", b => "boy", c => "cat" ); print "\n$hash2{$_}" for (sort keys %hash2); [download]
while we use the sort function in hash. We access keys in asc order.