http://www.perlmonks.org?node_id=100478


in reply to dynamically loading modules/maintaining dev v. prod modules

Try putting that code in a BEGIN block:
BEGIN { if( index( $ENV{SCRIPT_NAME}, '/dev/' ) == -1 ) { use lib "/blah/perllib/"; } else { use lib "/blah/perldev/"; } }
Update: My apologies too. Should have tested it before posting. As wog said in the node below the code above won't work, since both use lines would be run at compile time. All my votes go to wog. Thanks.