in reply to Trying to create a common "variable library"
Export those variables from a module.
Eg., have a common module that says something like (untested):
use warnings; use strict; package Foo::Common; use Exporter; push our @ISA, Exporter::; push our @EXPORT, qw" %red %green @blue %yellow $brown $purple "; our %red = ("foo", "bar");
and then use this module from all other modules by saying
which will import %red and all the other variables to your package.use Foo::Common;
You can then refer to these variables even if strict is on, as if you have declared them with use vars, only they refer to the respective variables from the common package. It also does not matter whether you set the values of those variables from the common package or some other package, just make sure you don't try to use their values before you initialize them.
|
|---|