Re: getting the value of a var



Octavian Rasnita wrote:

my $module = "Teddy::Languages::${lang}::${mod}";
eval "require $module";

Then I want to print that value, but I don't know how.

I have tried:

print Teddy::Languages::$lang::$mod::content;
print $module::content;

I am missing something and I cannot make it work. Please help me.

If everything fails you can access package variables via symbol table,

#symbol table
my $st = eval '\%$module::';
# scalar reference
$sref = *{ $st->{content} }{SCALAR};
print $$sref;

perhaps you could rearrange your problem so it wouldn't use such access to globals?
.




Relevant Pages

  • Re: Meet
    ... I really think we should rearrange ... the entire meet so we can all go to it without missing Dr Who. ... episode of the new series was a tad disappointing? ... Steve Hague ...
    (uk.religion.christian)
  • Re: Going nuts on this one...
    ... rearrange the structure of all the logic. ... or whatever you intent is. ... Tom Ogilvy ... What am I missing here. ...
    (microsoft.public.excel.programming)
  • Re: Meet
    ... I really think we should rearrange the ... entire meet so we can all go to it without missing Dr Who. ... "Beer is living proof that God loves us and wants us to be happy" Benjamin Franklin. ...
    (uk.religion.christian)
  • Re: Single User Setup
    ... Pay no attention to how xp is set up to start with. ... rearrange everything back to win 98 or win me and see what happens. ... missing this and missing that. ...
    (microsoft.public.windowsxp.newusers)
  • Re: Meet
    ... I really think we should rearrange the entire meet so we can all go to it without missing Dr Who. ... But it's not the same when you're watching it 5 hours later on a video, knowing this is 5 hours after the time when God, according to His divine plan, intended you to watch it. ...
    (uk.religion.christian)