in reply to scalar ref help?
Just to be sure, I want to advise you to read Dominus' archived newsposts, part one, two and three on Why it's stupid to 'use a variable as a variable name' if you haven't seen any detailed argumentation on the subject yet. There is only very rarely a valid reason to use symbolic references (much less heavy artillery like eval!).
What you're trying to do can be achieved with a hard reference as well:
perl -Mstrict -we'my $x = 8; my $xr = \$x; print $$xr, "n";'If you already know all this and know that you really need symbolic references, disregard this post (but not without careful reconsideration about whether you really need symrefs :-) ).
Makeshifts last the longest.
|
|---|