http://qs321.pair.com?node_id=818722

rovf has asked for the wisdom of the Perl Monks concerning the following question:

The following loop does not terminate:

# endless loop here while(my ($r,$s) = each(%{ {x=>5,y=>8}})) { print($r); };
The idea here is to denote the hash verbatim, without introducing a new variable, but this doesn't work. I believe the reason is that on each the hash constructed anew, and $r never advances to the next element. Of course I could code it like this:
# this works my $h={x=>5,y=>8}; while(my ($r,$s) = each(%{ $h })) { print($r); };
(or don't use references at all), but my question is: Is it possible to code this loop without naming the hash?

-- 
Ronald Fischer <ynnor@mm.st>