in reply to Unitialized value warnings with require
Split on ':', create a hash. Send it back to the calling prog as a reference.store_dir:/path-to/the-storage-dir
This is nice if you have a lot of programs that need to know what the store_dir is. You only have to modify your config file and all progs will recognize the change.my $config = getConfigVars (); my $storageDir = $config->{store_dir};
my %config; while (<DATA>) { my ($var, $val) = split (/:/, $_); $config{$var} = $val; } __DATA__ store_dir:/path-to/the-store-dir
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Using Variables
by jryan (Vicar) on Dec 28, 2001 at 00:03 UTC | |
by runrig (Abbot) on Dec 28, 2001 at 00:15 UTC | |
by chip (Curate) on Dec 28, 2001 at 01:04 UTC |