http://www.perlmonks.org?node_id=278655


in reply to Re: Re: recursive complex structure or something like that?
in thread recursive complex structure or something like that?

No, its just that the code I originally provided doesn't assume we know what the root is. If you follow $dict{1} you'll notice that everything works out alright. So the data is correct, you just may be mistaken on what you think the correct answer is (and that also handles cycles. You should use my second example with weaken(). The first example leaks memory).