in reply to if not defined question

A) why don't you dump the content to find out?

B) why don't you use else in 103 ?

C) probably the entry doesn't exist?

D) try to avoid autovivification in 100 if you are not sure about the existence of nested entries!

Cheers Rolf

(addicted to the Perl Programming Language and ☆☆☆☆ :)

update
Can't test but looks like autovivification of $id is the problem.