#./ThisPackage.pm package ThisPackage; sub new { local $, = ", "; local $\ = "\n"; print __PACKAGE__."::new(@_)"; } print "Dummy code gets run at compile/use time\n"; 1; #### #./pkg.pl BEGIN { print "this should print before\n" } use lib '.'; use ThisPackage; ThisPackage::new(qw/hello world/); BEGIN { print "this should print after the use, but before the new\n" } #### # output this should print before Dummy code gets run at compile/use time this should print after the use, but before the new ThisPackage::new(hello world)