develooper Front page | perl.perl5.porters | Postings from October 1999

Re: 'my' usage

Thread Previous
Ronald J Kimball
October 26, 1999 11:38
Re: 'my' usage
Message ID:
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:


       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


Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About