Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^3: why does Perl eval have a strange terminator?

by haukex (Archbishop)
on Jun 14, 2022 at 20:26 UTC ( [id://11144735]=note: print w/replies, xml ) Need Help??


in reply to Re^2: why does Perl eval have a strange terminator?
in thread why does Perl eval have a strange terminator?

Although I do understand that, it might have seemed more consistent to also make eval { } compound?

eval EXPR is often used more like a function ($sum = eval("3+4");), and the return value of eval BLOCK is important too (e.g. Bug in eval in pre-5.14). Thus it is consistent with e.g. do BLOCK, map BLOCK, grep BLOCK, and less with if, which though it has a "return value", I've very rarely seen it used, and e.g. the return value of for should explicitly not be relied upon (I can't find the reference for the latter right now but that's the gist of it). Think of eval like a function with a special syntax for its argument and it makes sense.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2024-04-19 20:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found