in reply to Tree Structure and Db

Take a look at DBM::Deep.

The source code for that module is a good read too.