in reply to RE: RE: keeping $$this defined locally
in thread keeping $$this defined locally

That template looks like it was written for a shell.

Anyways I would use a hash for the keys and regular expression substitution. So the first file would be read like:

my @entry = split(/=/, $line, 2); $val{$entry[0]} = $entry[1];
and then substitute them in with:
s/\$(\w+)/exists($val{$1})?$val{$1}:die "Undefined '$1' in entry '$new +string' (line $.)"/eg;
Now strict should be happy, and things are easy to scope. Plus I stuck a minimal error check in.

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
    Yup - combining a few messy sh scripts into a perl one.

    Thanks. I'll try doing that - i was actually going to do that initially - thought i'd take the easy route out and let eval do all my work for me though.

    Specimen