in reply to CGI and require

The idea behind packages is that they have their own namespace, and that namespace is neither polluted by, nor can it pollute the namespace of other packages (including package main), by default.

You want to take things a step further; set up your packages as modules. Your modules can export specific variables and/or subroutines. This is done using theExporter module. Follow the Exporter link to read its documentation. You also need to "use" the module instead of "require" it. require doesn't trigger the export of variables and subs.

Also be sure to have a look at perlmod to gain a better understanding of modules. You'll find it pretty helpful.


Dave