in reply to How to store CODE ref

New Perls can generate bytecode of scripts. Read documentation for module B::Bytecode. It relies on experimental support for Perl compilers so it can be unstable. Moreover I've heard that actually it doesn't give any perfomance boost and is actually slower. But don't trust me :) Check yourself.

However if you just want to optimize your code for web server probably you should use mod_perl. It allows to read all your code once on startup of web server so Perl code is not complied again and again.