
davorg
Thaumaturge
/ Moderator
Oct 23, 2006, 4:12 AM
Post #2 of 2
(12665 views)
|
Re: [sarathy] Please Help - Value not returned
[In reply to]
|
Can't Post
|
|
What you're doing here is using symbolic references. Symbolic references are a very bad idea and they should only be used very rarely. They are such a bad idea that if you're programming with "use strict" turned on (and you should _always_ program with "use strict" turned on) then Perl turns symbolic references into compile time errors. You very rarely have to use symbolic references (the only example I can think of is to alter the symbol table). You'll be far better off changing your code to use a hash instead.
my %vars; my $variable1 = 'variable2'; $vars{$variable1} = 'Actual value'; print $vars{$variable1}; -- Dave Cross, Perl Hacker, Trainer and Writer http://www.dave.org.uk/ Get more help at Perl Monks
|