in reply to Tree in perl with hashes

Try something like this for a basic node:
$node = { name => 'foo', children => [], };
This particular node has the name "foo" and no children. Adding a child to it, can be done like this:
push @{$parent->{children}}, $child;
where both parent and child are nodes set up as above.

Use Data::Dumper (/me looks sideways to demerphq for his reaction) to see what's in your tree, for experimentation.

Of course you're free to add more fields to a node, to hold the actual data.