|Do you know where your variables are?|
Re: eval with semicolonby tomazos (Deacon)
|on Oct 02, 2005 at 21:19 UTC ( #496788=note: print w/replies, xml )||Need Help??|
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 | email@example.com | www.tomazos.com
In Section Seekers of Perl Wisdom