in reply to Re: Check to see if a variable exists
in thread Check to see if a variable exists
Then you can:$config = \{ 'Variable1' => 'variable value', 'Variable2' => ['a','b','c'], };
This creates a variable $config that is a reference to a hash containing all your configuration variables. If your passing the configuration to subroutines you can just pass $config and your subroutine has access to all the config variables and you saved some overhead.do "config.txt" or die "$! $@";
Granted you have to dereference the hash, but references are a good thing to learn..
if (exists $config->{Variable1}) {}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Check to see if a variable exists
by hardburn (Abbot) on Nov 13, 2003 at 20:08 UTC |