CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner:
perl interpreter


New User

Sep 22, 2012, 7:33 AM

Post #1 of 3 (1503 views)
perl interpreter Can't Post

I want to know if perl is implemented using interpreter or a compiler?
My guess is interpreter.Please confirm or rectify!

Chris Charley

Sep 22, 2012, 8:31 AM

Post #2 of 3 (1501 views)
Re: [divineshiva] perl interpreter [In reply to] Can't Post;_ylt=AgvPe4Y3LfwxPWcBgCPMGSWbvZx4?p=perl+interpreted+compiled&toggle=1&cop=mss&ei=UTF-8&fr=yfp-t-701

Veteran / Moderator

Sep 23, 2012, 8:37 PM

Post #3 of 3 (1488 views)
Re: [Chris Charley] perl interpreter [In reply to] Can't Post

The short answer is that a Perl script is definitely compiled before anything happens. If compilation fails, the program will not run. In purely interpreted languages, the program could possiblty run for a while before a syntax error is found and stops execution. In Perl, this is not so, the entire source code is compiled before execution starts. If an error is found, the execution will not start, which sort of proofs that this is really a compilation phase.

But a Perl script is not compiled into binary code directly understandable by the processor, as is the case for C or C++ code, for example (I am simplifying, but that's the idea). This has some advantages (portability) and some drawbacks (more limited performance, in some cases only).

A perl scrip is compiled into what could be called byte codes or operation codes, that are then ran by the perl interpreter, somewhat similarly to what happens with Java code and the Java virtual machine.

(OK, this is simplification, the comparison between Java and Perl does make senses, but, then, there are some significant différences).


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives