[Techtalk] Perl Frustration

Kai MacTane kmactane at GothPunk.com
Fri Oct 31 02:50:28 EST 2003

At 10/30/03 07:34 PM , Jeff Dike wrote:
>kmactane at GothPunk.com said:
> > I want to declare a set of variables inside a loop, and have them be
> > accessible to the rest of the program. It's not known until run-time
> > just  how many of these variables there are, or what their names will
> > be. (They  may be acquired from user input, or from a configuration
> > file.)
>Why are you insisting that they be actual perl variables?  Much more pleasant
>would be a hash in which each configuration variable is a key.

At least one of the script in question is already released (see 
http://www.gothpunk.com/~kmactane/software/mlm-command), and some of the 
variables I'm looking at need to be available as actual variables. Either 
that, or I'll have to do some ugly hacking to keep the script's behavior 
the same. Or else just change the behavior, and the documentation.

I also thought, "Hey, I can just have them all be keys in a hash!" Then I 
looked at the docs again, and realized that wasn't going to do it. I 
essentially need to take some dynamically-input variables (let's say foo, 
bar and wombat), and wind up having $foo_extra, $bar_extra and 
$wombat_extra be available globally by the end of the script.

Is it possible?

                                                 --Kai MacTane
"I looked Death in the face last night,/I saw him in a mirror,
  And he simply smiled,/He told me not to worry:
  He told me just to take my time."
                                                 --Oingo Boingo,
                                                  "We Close Our Eyes"

More information about the Techtalk mailing list