in reply to Confused about complex data structures.

Your code appears to do what you think it does. Whether this is best approach or not depends on what you are going to do with the structure once it's in memory. The layout you've selected is great if you'll often need to work with all the records for a particular city, for example.

To see what your data structure looks like, you can use Data::Dumper to inspect the structure after you've built it:

use Data::Dumper; print Dumper(\%city_data);
or use the perl debugger (which I can't help you with, being of the printf() school of debugging, myself). :)

As for printing everything in one of your arrays, you've already got this licked: print @{ $city_data{$city}{$id} } will output the content of the file "${city}_${id}".