in reply to Re: Calling variable variables
in thread Calling variable variables

And if you DON'T know the package name at runtime . . .

my $package; print ${$package . '::a' };

But you shouldn't do that unless your TheDamian. ;-)

Cheers,
Erik

Light a man a fire, he's warm for a day. Catch a man on fire, and he's warm for the rest of his life. - Terry Pratchet

Update: You see, Perl, and computers in general, are a hobby for me - my favortive hobby, but a hobby. And when you take a little break from a hobby, sometimes your mind stales . . . and then if you get back to at some ridiculous hour of the morning, you can say stupid things. Moral? Ignore me, pay attention to chromatic.

Replies are listed 'Best First'.
Re: Re: Re: Calling variable variables
by Juerd (Abbot) on May 26, 2002 at 13:16 UTC

    But you shouldn't do that unless your TheDamian. ;-)

    Why not? It's often the only way to get to those variables. In scriptinfo.pl, an Irssi script, I use symbolic references all the time, and I know of no other way to do this. Symbolic references are to be avoided, but you can't always.

    my $name = ${ "Irssi::Script::${data}::IRSSI" }{name}; my $url = ${ "Irssi::Script::${data}::IRSSI" }{url}; my $version = ${ "Irssi::Script::${data}::VERSION" };

    - Yes, I reinvent wheels.
    - Spam: Visit eurotraQ.
    

Re: Re: Re: Calling variable variables
by Anonymous Monk on May 26, 2002 at 15:04 UTC
    Um, runtime is the point at which your code executes, if you don't know the package then, it is impossible to do anything sensible.

    Read chromatic's code more carefully and try running it a few times. He did answer the question.