S
Stephen O'D
Guys,
I am trying to create a program that requires a file, and the required
file needs to be able to see variables from the main program (perl
5.6.1):
eg
my %config;
%config = load_config();
# now I have a bunch of name value pairs
require "myotherfile.inc";
foreach my $step (@steps) {
# do something
}
myotherfile.inc includes something like the following:
@steps = ( "$config{KEY}/some/path/etc");
1;
When I run this %config is always undefined in the required file. I
even attempted putting $config in a package and exporting it, and
accessing it from %package::config but it is still undef.
I am obviously missing something about how this works - can someone
please shed some light on it for me? The steps array always contains
data and is accessible in the main program, but it just cannot see the
config hash I populated before requiring it ...
Thanks,
Stephen.
I am trying to create a program that requires a file, and the required
file needs to be able to see variables from the main program (perl
5.6.1):
eg
my %config;
%config = load_config();
# now I have a bunch of name value pairs
require "myotherfile.inc";
foreach my $step (@steps) {
# do something
}
myotherfile.inc includes something like the following:
@steps = ( "$config{KEY}/some/path/etc");
1;
When I run this %config is always undefined in the required file. I
even attempted putting $config in a package and exporting it, and
accessing it from %package::config but it is still undef.
I am obviously missing something about how this works - can someone
please shed some light on it for me? The steps array always contains
data and is accessible in the main program, but it just cannot see the
config hash I populated before requiring it ...
Thanks,
Stephen.