Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Re: eval with semicolon

by tomazos (Deacon)
on Oct 02, 2005 at 21:19 UTC ( #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 Tomazos  |  |

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2023-05-31 15:40 GMT
Find Nodes?
    Voting Booth?

    No recent polls found