Sep 23, 2012, 8:37 PM
Post #3 of 3
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.
Re: [Chris Charley] perl interpreter
[In reply to]
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).