On Tue, 5 Jun 2001, Marcelo E. Magallon <[EMAIL PROTECTED]> wrote,

>  Perhaps also noteworthy is the fact that things like '$foo{bar} eq ""'
>  make the key 'bar' spring into existance in %foo.  -w tells you about
>  it.

You mean $foo{bar}{baz} eq "".

perl -wle 'my %foo; if ($foo{bar} eq "")
           {print exists $foo{bar} ? 1 : 0}'
Use of uninitialized value at -e line 1.
0

perl -wle 'my %foo; if ($foo{bar}{baz} eq "")
           {print exists $foo{bar} ? 1 : 0}'
Use of uninitialized value at -e line 1.
1


>From the article (by Uri Guttman) in,

    http://tlc.perlarchive.com/articles/perl/ug0002.shtml

    "...autovivification happens when Perl automatically create
     a reference of the appropriate type when an undefined scalar
     value is dereferenced."

I've been using it a lot of times without realizing it.  I just learned
it myself.


s.a.n
-- 
Hasanuddin Tamir: [EMAIL PROTECTED] - Trabas: www.trabas.com

Reply via email to