Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re^2: Perl is a compiler cum interpreter?

by izut (Chaplain)
on Feb 15, 2007 at 08:37 UTC ( #600153=note: print w/replies, xml ) Need Help??

in reply to Re: Perl is a compiler cum interpreter?
in thread Perl is a compiler cum interpreter?

Perl does both. It runs over the source code and compiles it into an intermediate form. It then "interprets" the intermediate form. Note that this gets somewhat more interesting when eval is involved because the code fragment passed into eval needs to be compiled and interpreted in its turn.

From perldoc -f eval

In the second form, the code within the BLOCK is parsed only once--at +the same time the code surrounding the "eval" itself was parsed--and execu +ted within the context of the current Perl program. This form is typicall +y used to trap exceptions more efficiently than the first (see below), while also providing the benefit of checking the code within BLOCK at compile time.

P.S.: I'm posting this for those like I had somekind of doubt if eval BLOCK interprets and compiles the code inside BLOCK. The answer is no.

Igor 'izut' Sutton
your code, your rules.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2021-02-26 13:14 GMT
Find Nodes?
    Voting Booth?

    No recent polls found