Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

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

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2021-06-12 22:28 GMT
Find Nodes?
    Voting Booth?
    What does the "s" stand for in "perls"? (Whence perls)

    Results (53 votes). Check out past polls.