represent a perl script in binary

A

Alex Lee

Dear all:

I know this is going to sound strange but is there any way I can
convert a perl script ot binary 0's and 1's and excute it.
---------------------------------------------------------------
For example: print "fox";

represent it as 0's and 1's save or store it somewhere and have perl
excute the binary directly.

So far ...
I tried to convert every character to ASCII representation
unpack("c*",'letter');
my $str = unpack("B32", pack("N", shift)); # convert it binary

store it. When I want to excute it, I figure that I could work
backwards and run the script via eval.

But this seems awfully slow - one character at a time.

----------------------------------------------------------------
Just wanted to know if anyone knows of a better way to do this. It
would be very nice if I can run the script after its been converted to
binary directly instead of having to convert it back to ascii and run
the script.


Thanks a bunch guys!
al
 
J

Joe Smith

Alex said:
I know this is going to sound strange but is there any way I can
convert a perl script ot binary 0's and 1's and excute it.

perldoc -q "hide the source"
 
J

Joe Smith

Alex said:
thanks but that is not what I was looking for.
please read previous posting.

I re-read it, and still don't know what you're asking for.
if I can run the script after its been converted to binary directly

The Java compiler converts text and outputs binary in the form of bytecodes.
Perl does not create a simple stream of sequential bytes.
It creates an opcode tree more complicated than a linked list.

In case this is an X-Y problem (where a poster asks about Y but really intends
to do X), please specify what you're trying to accomplish and why.
-Joe
 
M

Mothra

Alex said:
Dear all:

I know this is going to sound strange but is there any way I can
convert a perl script ot binary 0's and 1's and excute it.
---------------------------------------------------------------
For example: print "fox";

represent it as 0's and 1's save or store it somewhere and have perl
excute the binary directly.
Why do you want to convert the script to binary?
 
J

Jeff Dunn

Mothra said:
Why do you want to convert the script to binary?

If you are looking to compile your script into an executable program
you can use on systems without perl ??? Then goto activestate.com
they have a compiler perlapp
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,190
Latest member
Martindap

Latest Threads

Top