enigmae has asked for the wisdom of the Perl Monks concerning the following question:
Hello,
I am trying to have my script go through some
variables without the variable names being there until
the code is run. I think this is late-binding but i am
not entirley sure. Here is what i want to do.
cause the variable names are all in cmd_table hash
referenced by a number (where test_array is a array of
command numbers. Is there a way to so what i want?
Thanks.
Enigmae
I am trying to have my script go through some
variables without the variable names being there until
the code is run. I think this is late-binding but i am
not entirley sure. Here is what i want to do.
What the code would look like that is late-bound ismy result_temp=""; foreach my $test (@testarray) { if(!defined($result_temp = $session->getrequest( -varbindlist => ['$'.%cmd_table{$test}] ))) { print ("error in session:%s", %cmd_table{$test}); $result_temp="error"; } push @RESULTS, @result_temp; }
but what will the perl interpreter see?-varbindlist => [$myvariable]
cause the variable names are all in cmd_table hash
referenced by a number (where test_array is a array of
command numbers. Is there a way to so what i want?
Thanks.
Enigmae
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: using variables in late contexts?
by Eimi Metamorphoumai (Deacon) on Nov 26, 2002 at 22:46 UTC | |
Re: using variables in late contexts?
by robartes (Priest) on Nov 26, 2002 at 22:37 UTC | |
Re: using variables in late contexts?
by jreades (Friar) on Nov 26, 2002 at 22:34 UTC |
Back to
Seekers of Perl Wisdom