Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: eval with semicolon

by tomazos (Deacon)
on Oct 02, 2005 at 21:19 UTC ( [id://496788]=note: print w/replies, xml ) Need Help??


in reply to eval with semicolon

For historical reasons, to make it easier for perl to parse your Perl, eval is classified as an expression.

As an expression it needs to be seperated from the next expression so that perl doesn't get confused.

The advantage of having it as an expression is that it can have a return value. (In this case, the result of the evaled code)

By adding a ; to the end of an expression it turns it into a statement.

The ; is not added automatically because this would make the job of parsing harder for perl. Different languages have different approaches to dealing with this, but as a member of the C family - Perl requires certain statements to be delimited explictly with a ;.

-Andrew.


Andrew Tomazos  |  andrew@tomazos.com  |  www.tomazos.com

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://496788]
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-18 03:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found