On Fri, 13 Aug 2004, Jeff 'japhy' Pinyan wrote:

On Aug 13, Anish Mehta said:

I have some doubts on whether perl is compiled or interpreted. Can someone explain what are the files generated when we run a perl program. I mean if it is both compiled and interpreted then what is the process.

A Perl program's source code is compiled into an intermediate state called "bytecode", and then that bytecode is executed. There are efforts lately (specifically the PAR project at http://par.perl.org/) to make compiled versions of Perl applications.

That said, the bytecode only exists in memory while the code is running, right? It's only a transient existancce.


I think that Anish is thinking of languages like Java & Python, which store that bytecode in a file and then execute that file -- e.g. run a Python script "foo.py" and you end up with a bytecode "foo.pyc", and later on you can skip the startup time by just running "foo.pyc".

Perl doesn't do this because the interpreter itself is designed to launch pretty quickly, so the "compilation" step isn't as expensive as it is in a language such as Java.

That said, as Jeff notes, the PAR project is trying to get this kind of functionality for Perl5, and one of the design goals for Perl6 will be the ability to work with bytecode or fully compiled machine code in ways similar to Java, Python, or even C/C++. But that's a ways off yet... :-)


-- Chris Devers

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to