On Fri, 07 Nov 2008 12:44:40 +0000, Nigel Rantor wrote: > Yes, well, Perl has 'each' for iterating over pairs, so they look > almost identical. The main difference I can see is that python > defaults to assuming you want the keys of a hash when iterating > rather than the values. Perl also has 'each' for iterating over keys, and there's no default - it's always explicit, though possibly a bit subtle: while(my($k,$v)=each %h){ # Explicit iteration of pairs } while(my $k=each %h){ # Explicit iteration of keys } You could argue that making it robust in the face of false keys reduces the subtlely somewhat, but the extra unwieldiness also obscures the intent somewhat in my view: while(defined(my $k=each %h)){ } -- Peter Haworth pmh@edison.ioppublishing.com "Unfortunately, in this case, ``obvious'' is synonymous with ``wrong''." -- Larry Wall in Apocalypse 3