FWIW, I agree with everything you said. However, I think you made a little error:
my @list = map( "$_ beads", @colors ), @grey_scale;
I think @list will not contain anything from @grey_scale, and would warn with something like "Useless use of private array in void context", because the assignment precedes the comma operator.
I do prefer the expression form with parentheses, though, partly because of an (I believe) obsolete reason which was that the block form would generate a new lexical space whereas the expression form wouldn't, so the expression form was apparently slightly more performant (on very large lists).
I also like making hashes with something like...
my %h = map +($_ => 1), @a;
...I guess because it seems the most generally correct, given the possible parsing bugs with Perl and map, but at the same time I can see that it's possibly confusing, especially given the "array in void context" comment above. :)
In reply to Re: Expression form of map or grep
by ForgotPasswordAgain
in thread Expression form of map or grep
by Lady_Aleena
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |