Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
and in a library file, i store some subroutines that use this config hash:#!/usr/bin/perl -w use strict; require "subs.pl"; # declare and define config my %CONFIG = ('key' => 'value');
this, of course, doesnt work. the test() sub doesnt see the %CONFIG hash, because its declared local with my() in a whole other file. i've tried declaring the hash with our(), to no avail...how can I accomplish this?sub test { print $CONFIG{'key'}; } 1;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: use variable from main file in a 'require'd file?
by sgifford (Prior) on Jun 12, 2006 at 16:46 UTC | |
|
Re: use variable from main file in a 'require'd file?
by Fletch (Bishop) on Jun 12, 2006 at 16:41 UTC | |
|
Re: use variable from main file in a 'require'd file?
by ioannis (Abbot) on Jun 12, 2006 at 18:06 UTC |