Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: symbolic variables

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


in reply to symbolic variables

If by "second assignment" you mean my $pvar = ${ $name . "::VAR" };, all you've done is create a new lexical scalar with the value contained in the package variable $pkg2::VAR. There's nothing tying this new variable back to $pkg2::VAR.

If that's what you wanted you'd either need to have a scalar reference my $pvar = \${ $name . "::VAR" };" and use that (${ $pvar } = 22), or make an alias to the original variable (local *pvar = \${ $name . "::VAR" }; $pvar = 22;).

The cake is a lie.
The cake is a lie.
The cake is a lie.

Log In?
Username:
Password:

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

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

    No recent polls found