Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Re: searching nested structures

by IOrdy (Friar)
on Jan 05, 2004 at 05:13 UTC ( #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( 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?

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (6)
As of 2023-01-30 12:28 GMT
Find Nodes?
    Voting Booth?

    No recent polls found