Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Confused about complex data structures.

by saucepan (Scribe)
on Jan 18, 2001 at 05:13 UTC ( [id://52660]=note: print w/replies, xml ) Need Help??


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}".

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://52660]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (3)
As of 2024-04-24 20:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found