use warnings; use strict; package RunableModule; #... normal module stuff here sub InterestingEntryPoint { print "Hey, it works\n"; } # Execute the InterestingEntryPoint sub if being run as a script InterestingEntryPoint () unless caller (); 1;