Thus spoke Al (on 2006-06-23 16:24):
Within my program, there is an existing variable called: $myvariable
How can I address this variable in terms of the command line argument -
i.e., how do I find the value of $myvariable by referencing what was
passed on the command line? For example:
if ([command line argument substitution designating $myvariable] =~
'hello' )...
Names are hash entries in the perl guts,
so use your own hash for your names, like:
my %NAMES;
my ($varname) = shift; # <== will be 'myvariable' etc.
$NAMES{ $varname } = 1e-4;
print "name of variable was: ",
grep { /$varname/ } keys %NAMES;
# above is basically the same as :
# print "name of variable was: ", $varname;
print "\nactual value of it is: ", $NAMES{ $varname }, "\n";
Don't use Perls Name-Hash directly, as most others
here have already said.
Regards
Mirco