in reply to Configuration files via require or do and my, local.

One way to address this problem is to declare the config file variables as package-scoped in the main program (before reading the config file):

use vars qw($scalar1 @array2 %hash3);

Then they're available in all blocks of the main program, including the external config file, without 'my' or 'local'.   There can be significant drawbacks associated with global vars, but this approach works in Perl back to at least 5.04.   Whereas 'our' was new in 5.6, I think.

You might find Dominus' Coping with Scoping to be a relevent read.

    cheers,
    Don
    striving toward Perl Adept
    (it's pronounced "why-bick")
  • Comment on Re: Configuration files via require or do and my, local. (global/package-scoped)
  • Download Code