in reply to How do "you" make a tree in perl

Well, now that you 're asking...
I usually find myself wanting to store a tree in a database.
When i request a leaf by ID, i want to get the path, and when i get a leaf by path, i want to know its id.

Also, it's nice to know the previous/next (sibling) of a leaf.
I currently store the tree in a table like so:
id parent node 1 0 Root 2 1 Fruit 3 2 Apple 4 2 Pear 5 2 Banana 6 1 Vegetable 7 6 Spinach
I think you get the idea. The items usually aren't sorted like they are in the example above.