Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: syntax error with map in list context

by Aristotle (Chancellor)
on Nov 20, 2005 at 17:52 UTC ( #510260=note: print w/ replies, xml ) Need Help??


in reply to syntax error with map in list context

There are two ways to unconfuse perl about whether you mean a block or an anonymous hash, depending on which one it is:

  1. +{ ... } is always considered an anonymous hash. The unary plus is generally used to explicitly signify that what follows is an expression.

  2. {; ... } is always considered a block.

You’ll find that if you write your code as map {; ... } ..., it works.

Makeshifts last the longest.


Comment on Re: syntax error with map in list context
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://510260]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2015-07-05 22:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (68 votes), past polls