Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Location of Conditional test effects results

by ferreira (Chaplain)
on Apr 10, 2007 at 19:43 UTC ( #609240=note: print w/replies, xml ) Need Help??


in reply to Location of Conditional test effects results

That's called autovivification IIRC. See:

$ pirl Welcome to the Perl shell. Type ':help' for more information pirl @> %a = () () pirl @> print "ok" if $a{k} undef pirl @> \%a # no surprise {} pirl @> print "ok" if $a{k}[0] undef pirl @> \%a # bang! { k => [] }

When accessing elements of a structure (hash or array ref) in a nested level, you may find out that Perl "helpfully" sprang some structures to life. If you're not ready for this, it may give a lot of headache.

Autovivification issues happen a lot here. See for example Hash Autovivification Weirdness, Re: Array mysteriously growing (autovivification explained), Autovivification of scalars in sub calls, Autovivification for dummies (using Test::More), The Bad, the Ugly, and the Good of autovivification or look for more following the super search http://www.perlmonks.org/?node_id=3989;HIT=vivification.

Replies are listed 'Best First'.
Re^2: Location of Conditional test effects results
by chakram88 (Pilgrim) on Apr 10, 2007 at 20:24 UTC
    Well, sure, it's clear now. Thanks for the explanation, and lots of info to absorb.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://609240]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2020-10-21 14:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (217 votes). Check out past polls.

    Notices?