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

Re: [FWP] hasheesh



Today around 12:03pm, Jeff Pinyan hammered out this masterpiece:

: 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;

Point taken,

: 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. ;)

I know, that's why I like his better.  Besides, I said it was
*something* like that. :)

I like to do simple processing of hashes/lists in one (visualy
one) operation.  So, I now have a better way to do that :)

-- 
Casey West


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