As for solutions, I don't think there are any better ways than those you have tried. Compiling any script-type (or interpreted) language that isn't intended to be made into binaries has always had these problems, as far as I can tell. I even remember there being BASIC to machine code compilers for the good old Commodore 64, and those had the exact same problem.
I think the basic problem is that you have a language that is (more or less, I know it isn't really true) interpreted on the fly, with the commands in the program being "references" to built-in functions in the interpreter, which are called and something happens. This is very hard to translate into effecient c or assembler code, usually the realistic approach is to either embed the whole interpreter and still call the same things, or replace each call with the corresponding function from the interpreter. Needless to say, this isn't gonna be very optimized - but at the same time, code that wasn't meant to be compiled is very hard to guess the optimized intention of.
As mentioned in perlrun, you have the -u option, and could use the undump program, but according to the example, that gets just as bloated, or worse. It is also very much deprecated in favour of the c-compiler alternatives you have already tried.
In short, if you need to hide your code for some reason, perl might not be the right tool for you. It is constructed with quite the opposite intentions, and it shows. On the other hand, if this is a special ocassion, is 20MB really that much? If it is just this program, this one time, just go for it if it works. It might feel silly to have 20MB worth of program printing "Hello world", but if it does the job... disk is cheap. :)
Also have a look at Can I get compiled code in Perl like in Java(class file), I seem to recall some good and related answers there.
In reply to Re: Compiling Perl
by Dog and Pony
in thread Compiling Perl
by Anonymous Monk
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |