http://qs321.pair.com?node_id=543536

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

hai monks,
I heard the perl program is compiled and interpreted.
it is compiled and interpreted each time before execution.
What will be the ouput file when the perl program is compiled??.
As java gives bytecode with the extension of class for the compiled java program.

Edited by planetscape - fixed br tags

Replies are listed 'Best First'.
Re: perl program compilation
by eXile (Priest) on Apr 15, 2006 at 14:26 UTC
    Normally the compiled form isn't dumped to file, perl does the compilation in memory.

    You can produce a perl bytecode by using B::Bytecode:

    perl -MO=Bytecode,-H -e'print "hello world"' > hi.plc
    hi.plc will be an executable, with a first line telling perl how to decode the bytecode (caused by the '-H' option), the rest is a bytecode.
Re: perl program compilation
by saintmike (Vicar) on Apr 15, 2006 at 15:19 UTC
    The FAQ explains some of the concepts.
      monks,
      Is it correct that the compilation and intrepretation of perl program is done at the same time???

        Actually no in intrepretor parses a program and executes it directly.

        Compiling translates the program into machine code.

        A reply falls below the community's threshold of quality. You may see it by logging in.
Re: perl program compilation
by Anonymous Monk on Apr 15, 2006 at 17:07 UTC
    Monks,
    we are giving
    c:\perl\bin> perl perlpro.pl
    to execute the perl program.
    In the above, "perl" command is an interpreter or compiler???
      thats interpreted
        quoted from: Perl2Exe
        Perl2Exe

        Perl2Exe is a command line program for converting perl scripts to executable files.

        This allows you to create stand alone programs in perl that do not require the perl interpreter. You can ship the executable files without having to ship your perl source code.

        Perl2Exe can generate executables for Windows and Unix target hosts.

        Perl2Exe can generate cross-platform code. For example you can generate code for Solaris from a Linux machine.

        Perl2Exe also allows you to create no-console programs using Tk.

        perl2exe myscript.pl

        This will convert a script named myscript.pl to myscript.exe

A reply falls below the community's threshold of quality. You may see it by logging in.