in reply to
Can I get compiled code in Perl like in Java(class file)
gellyfish is correct that B::Bytecode will create Bytecode for a Perl program, very similar to .class files in Java. Based on the requirment as stated, and the problems i have personally had using B::Bytecode, i am more prone to suggest perlcc.
While perlcc is also listed as experimental, on Unix servers with gcc i have had very good luck with it. I suggest it for giving a try.Also, you may want to take a look at Super Search to see what people have said about using this kid of thing for security .I don't think they say good things, but most of the time this question come up not with sevrer side code, but client side code.
from the frivolous to the serious