Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://510260]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2016-12-08 18:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (144 votes). Check out past polls.