Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: searching nested structures

by IOrdy (Friar)
on Jan 05, 2004 at 05:13 UTC ( [id://318781]=note: print w/replies, xml ) Need Help??


in reply to searching nested structures

Thanks all, I can see whats going on now and I understand why it's happening but I'm still at a loss as how to avoid autovivification without breaking up the origional pattern into parts and testing them one at a time.

Roger: Because 'exists' still wont stop autovivification your solution above will still muddy the origional structure (If you Dumper($data) after searching you can see empty foo => {}'s everywhere.)

Update: For future reference I found this article(perlarchive.com) which had an example sub to get me started on testing deep structures without triggering autovivification.

Replies are listed 'Best First'.
Re: Re: searching nested structures
by pg (Canon) on Jan 05, 2004 at 05:18 UTC

    Unfortunately, you have to control this yourself.

    To avoid unwanted autovivification, before read/test an element, always first make sure the existance of all its ancestors. That "all" in bold is automatically guranteed, if your checking is start from the oldest ancestor, and stops at the first sight of a non-exist ancestor.

Log In?
Username:
Password:

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

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

    No recent polls found