# wrap the initial declaration in a begin block BEGIN { $softwarepath = "/usr/local/etc/software"; } use module; # or eval the use, so it happens at run time $softwarepath = "/usr/local/etc/software"; eval { use module; } # or do the require/import yourself $softwarepath = "/usr/local/etc/software"; require module; module->import(); # or modify the module to accept the path as an option use module path => "/usr/local/etc/software";