I think you can do this by putting the code in a BEGIN block. A BEGIN block asks Perl for a bit of run-time during compile-time. Thus, if you've got something happening at run-time that you'd rather have happen during compilation, BEGIN will usually do the trick.