in reply to Re: Can't use string ("") as a HASH ref while "strict refs"
in thread Can't use string ("") as a HASH ref while "strict refs"
our %config;
should this be creating references, instead of simply hash elements? Sorry for delay in responding. I was interrupted by a customer here. Thanks for your help and insight.while (<DB>) { chomp; next if /^\s*\#/; # Allow comments next if /^\s*$/; # Allow blank lines unless (/=/) { # All other lines must look like: KEY + = VAL die "invalid variable assignment in supporters.db: $_"; } my ($key, $val) = split(/\s*=\s*/,$_,2); # Key and value are separ +ated by equals and maybe space $key =~ s/^\s*//; # Strip any leading space from the key # $val =~ s/(\$(\w+))/$config{$2}/g; # Very simple (read: brittle) v +ariable interpolation $val =~ s/ *$//g; # Strip trailing white space from value $config{'db'}{'$key'} = $val; } close DB;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Can't use string ("") as a HASH ref while "strict refs"
by ikegami (Patriarch) on Nov 26, 2005 at 03:27 UTC | |
by hesco (Deacon) on Nov 26, 2005 at 05:08 UTC | |
by ikegami (Patriarch) on Nov 26, 2005 at 05:15 UTC | |
| |
|
Re^3: Can't use string ("") as a HASH ref while "strict refs"
by bart (Canon) on Nov 26, 2005 at 09:16 UTC |