@parts=split /\//,$dirname; %hash{ @parts } = (); ## this doesn't work, of course, ## just an example of the idea