# endless loop here while(my ($r,$s) = each(%{ {x=>5,y=>8}})) { print($r); }; #### # this works my $h={x=>5,y=>8}; while(my ($r,$s) = each(%{ $h })) { print($r); };