in reply to Changing a variable which is a value of a hash
the content of the hash does not change, it is still 'test', because the assignment:$test = 'test'; %hash = ( t => $test); $test = 'changed';
is storing into the hash the content of the $test variable at the time this assignment is done. Modifying the $test variable afterwards will not modify the content of the hash.%hash = ( t => $test);
But if you do:
then, of course the value in the hash will be modified because that's precisely a common way to modify the content of a hash for a given key.$change = 'changed'; $hash{t} = $change;
|
---|