[Israel.pm] P roblem with

Yuval Yaari yuval at windax.com
Sun Oct 17 10:47:55 PDT 2004


Offer Kaye wrote:

>On Sun, 17 Oct 2004 15:39:11 +0200, Alex Behar wrote:
>  
>
>>| while(($key,$val) = each %ENV){
>>|         print $key.":".$val."\n";
>>| }
>>equivalent to
>>foreach(keys %ENV){print $_.":".$ENV{'$_'}."\n"}
>>
>>    
>>
>
>Just curious - do you *really* think that removing whitespace and
>proper indentation and using $_ makes your code *clearer*, compared to
>the original?
>
>  
>
Playing golf, are we? :)
And his code wouldn't work anyway ($ENV{'$_'} ???).
print map { $_ . ':' . $ENV{$_} . "\n" } keys %ENV;
I still believe the original is much clearer, I just use map for 
everything :)

  --Yuval



More information about the Perl mailing list