Duh v D'oh

Paul Johnson paul at pjcj.net
Thu Nov 13 10:24:27 GMT 2008


On Thu, Nov 13, 2008 at 10:12:25AM +0000, Peter Haworth wrote:

>   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)){
>   }

$ perl -MO=Deparse -e 'while(my $k=each %h){}'
while (defined(my $k = each %h)) {
    ();
    }
$

-- 
Paul Johnson - paul at pjcj.net
http://www.pjcj.net


More information about the london.pm mailing list