Ok so here's the deal...I have the following:
$var = 123;
GetOptions( 'v|var=n' => \$var);
%xyz = (
type1 => { ABC => "after zero comes $var", },
type2 => {...etc.},
);
get_var() if $condition;
sub get_var {
$var = `external gui app to get input from user`;
chomp($var);
}
print "$xyz{type1}{ABC}\n";
All looks good and well, but $var in %xyz retains it's original value
while the global variable $var gets changed to lets say 456, which is
a moot point since we're not printing $var, we're printing the hash
value.. I've tried declaring the subroutine before the hash, but it's
not really feasible considering the application, nor did it change the
outcome when I tried. Using the command line option --var=456
obviously changes the variable before %xyz is even interpreted. So my
question is (as the title states)...how do I modify a variable in a
global hash value after the hash has been declared? Keep in mind that
the key ABC => "etc.." must remain there since $condition won't always
exist, and since the option to modify it with --var also won't exist
when $condition is met.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/