in reply to RE: RE: keeping $$this defined locally
in thread keeping $$this defined locally
Anyways I would use a hash for the keys and regular expression substitution. So the first file would be read like:
and then substitute them in with:my @entry = split(/=/, $line, 2); $val{$entry[0]} = $entry[1];
Now strict should be happy, and things are easy to scope. Plus I stuck a minimal error check in.s/\$(\w+)/exists($val{$1})?$val{$1}:die "Undefined '$1' in entry '$new +string' (line $.)"/eg;
Oh, and strangle the person who wrote the stupid template willya?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: RE (tilly) 3: keeping $$this defined locally
by Specimen (Acolyte) on Oct 04, 2000 at 19:37 UTC |