in reply to trees of word lists

You could try a hash with concatenated keys (i.e. $table{'Truck.Car.Scooter'} rather than $table{Truck}{Car}{Scooter}), and determine when to display a new subtree when looping through the sorted keys of the hash after you've preprocessed your table.

When doing the display you'd have to keep track of how far down you are in the "structure" (i.e. how many periods are in the key) and what the previous key had been (so you'd know whether or not to start a new branch).