in reply to directory listing to array tree

You don't need a multi-dimensional array to do that. You could get the same effect without the complexity by taking advantage of the regular syntax of Unix name:

Presto, there you have your output. I'm not posting code on purpose. Without context for why you are interested in this question, it smells a lot like homework or a search for hints in a golf contest. If I'm providing help for that sort of thing, I generally like to know that I'm doing so, so I can make a judgment about how much help is too much (or too little) help. Perhaps you could add a few words about why you care about this?

Best, beth