convert perl scripts into binaries

September 26th, 2006 mysurface Posted in Developer, file, Misc, perl, perlcc | Hits: 58035 | 4 Comments »

You can covert perl script into ELF binary files, c source code, bytecode etc. You do this my using perlcc.

You can have list of examples by just

man perlcc

But here, i gonna only show you few. First let us generate a perl script, create a file call hello

print "hello world. ";

Convert it into executable,

chmod +x hello

Try to run it, that is our normal perl script.

To make it as a binary with ELF header, do this

perlcc -o hello-bin hello

So what is the different? Check with file command,

file hello*


hello:     perl script text executable
hello-bin: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped

File shows that “hello” is perl script, where “hello-bin” is a ELF executable binary file.
Usually if you want to do a single line perl, you do this

perl -e 'print "hello world. " '

Now same thing, if you want to convert a single line perl to bin, you do this

perlcc -e 'print "hello world. " ' -o hello-bin

4 Responses to “convert perl scripts into binaries”

  1. This is not at all what i need. I need to convert perl scripts into bin files or binary files for writing an operating system.

  2. is not documented where can we get perlcc

  3. Surprisingly individual friendly website. Huge details readily available on few gos to
    madden nfl 17

  4. Many thanks very helpful. Will share website with my friends
    nhl 17

Leave a Reply