Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Autovivification Oddity

by shmem (Chancellor)
on Feb 11, 2018 at 13:27 UTC ( [id://1208954]=note: print w/replies, xml ) Need Help??


in reply to Autovivification Oddity

Your last example is comparable to

perl -wMstrict -MData::Dump -e' my $x = $a->{list}->[0]; dd $a' { list => [] }

since indexing autovivifies the anonymous array, as perlref explains. Retrieving its highest index is also a way of indexing.

But I agree, autovivification is important enough to warrant a section on its own in e.g. perldata, which mentions it only once and refers to perlref.

perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2024-04-19 14:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found