in reply to symbolic variables
note that the "+++" print shows that pvar is the variable pkg2::VAR. i just can't assign to it.It doesn't show that, it just shows that it contains the same value as $pkg2::var. You copied that value in the line above it. update: and you can assign to it: you even do so in your code. If you print the value of that var you can see that you are in fact modifying a copy.
Try this and re-read perlref.
no strict 'refs'; my $rvar = $name."::VAR"; $$rvar = 44; print $pkg2::VAR;
|
|---|