Front page | perl.perl5.porters |
Postings from October 1999
'my' usage
Thread Next
From:
Andrew Dubry
Date:
October 26, 1999 11:33
Subject:
'my' usage
Message ID:
3.0.1.32.19991026113834.0090d130@mail.musiciansfriend.com
Apologies in advance if this is not the proper group to ask this question...
I noticed an odd functionality in the use of 'my'. Take a look at this
sample code:
#!/usr/local/bin/perl
my $nq1 = 5;
$tempvar_name = "nq1";
print "tempvar_name=$tempvar_name\n";
print "nq1=$nq1\n";
print "value of tempvar_name=$$tempvar_name\n";
$$tempvar_name should print out 5. But it DOESNT unless I remove the 'my'
from the $nq1 in the first line.
Is there a lexical reason or something that 'my' does not work the way I
thought it should in the above code??
TIA!
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Andrew
Web/Internet Programmer (ext. 475)
Cookie Master
mailto:service@musiciansfriend.com
Musician's Friend (http://www.musiciansfriend.com)
1-800-776-5173
Thread Next
-
'my' usage
by Andrew Dubry