http://qs321.pair.com?node_id=538407


in reply to how to construct tree from parent pointer list

or yet another alternative: Tree::Simple