in reply to Trying to understand hashes (in general)

The keys and values of your hash are the same because your code sets them that way $dirs{$file}=$fileyou just want your has to have keys and no values you could use $dirs{$file}=''