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

Re: [perl #24139] Symbol Table entry always return defined for {SCALAR}!!!

Thread Previous
From:
Steve Grazzini
Date:
October 6, 2003 23:54
Subject:
Re: [perl #24139] Symbol Table entry always return defined for {SCALAR}!!!
Message ID:
20031007063033.GA13206@grazzini.net
On Tue, Oct 07, 2003 at 04:48:44AM -0000, Graciliano M. P. wrote:
> Why when you access the {SCALAR} key of a symbol entry in the 
> Symbol Table of a package it always return a scalar reference?!
> Even if the scalar, or any symbol (array, hash, glob) with this
> name is not defined!

> At least this need to be documented!

It's in perlref:

    *foo{THING} returns undef if that particular THING hasn't been
    used yet, except in the case of scalars.  *foo{SCALAR} returns
    a reference to an anonymous scalar if $foo hasn't been used yet.
    This might change in a future release.

-- 
Steve

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About