Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: symbolic variables

by Joost (Canon)
on Jan 04, 2008 at 00:48 UTC ( [id://660352]=note: print w/replies, xml ) Need Help??


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;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://660352]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2024-04-25 18:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found