in reply to Data structure question: Directory-in-memory ?

How about storing your value in the hash with a name of '/'. '/' can be no part because you split on it.
$hash{foo}{'/'}=1; $hash{foo}{bar}{'/'}=1;
and so on...