Front page | perl.perl5.porters |
Postings from October 1999
Re: 'my' usage
Thread Previous
From:
Ronald J Kimball
Date:
October 26, 1999 11:38
Subject:
Re: 'my' usage
Message ID:
19991026143813.E372911@linguist.dartmouth.edu
On Tue, Oct 26, 1999 at 11:38:34AM -0700, Andrew Dubry wrote:
> 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:
perlref:
Only package variables (globals, even if localized) are
visible to symbolic references. Lexical variables
(declared with my()) aren't in a symbol table, and thus
are invisible to this mechanism. For example:
local $value = 10;
$ref = "value";
{
my $value = 20;
print $$ref;
}
This will still print 10, not 20. Remember that local()
affects package variables, which are all "global" to the
package.
Ronald
Thread Previous