Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: syntax error with map in list context

by Aristotle (Chancellor)
on Nov 20, 2005 at 17:52 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://510260]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2024-04-24 21:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found