Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: failure to compile list eval in block

by LanX (Saint)
on Dec 16, 2012 at 00:22 UTC ( [id://1009025]=note: print w/replies, xml ) Need Help??


in reply to failure to compile list eval in block

Perl's parser uses heuristics to make the distinction between hashes and code-blocks.

Because of the numbers (remember => is just a fat comma) this is interpreted as a hash.

eliminating the ; helps seeing what's happening

> perl -MO=Deparse { 7, 10 } __END__ +{7, 10}; # <-- a literal hash

But what do you expect a codeblock with 7,10 to do?

EDIT:

one workaround to help the parser understand your intentions is an early semicolon

perl -MO=Deparse { ; 7,10; } __END__ { '???', '???'; # <-- constants in a codeblock }

Cheers Rolf

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (5)
As of 2024-03-28 19:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found