[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] hasheesh



On Mar 29, Casey West said:

>I use something like this:
>
>map {
>     # processing here
>     print "$_->[0] => $_->[1]\n"
>    } map { [ each %ENV ] } keys %ENV;

Ouch.  You just created a list of the keys in %ENV for no good
reason.  Why not do:

  map { ... } map { [ $_ => $ENV{$_} ] } keys %ENV;

if you're going to use keys %ENV.  Or, use it in the scalar context:

  map { ... } map { [ each %ENV ] } 1 .. keys %ENV;

But map() in void context is evil. ;)

-- 
Jeff "japhy" Pinyan      japhy@pobox.com      http://www.pobox.com/~japhy/
Are you a Monk?  http://www.perlmonks.com/     http://forums.perlguru.com/
Perl Programmer at RiskMetrics Group, Inc.     http://www.riskmetrics.com/
Acacia Fraternity, Rensselaer Chapter.         Brother #734


==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe