r.joseph has asked for the wisdom of the Perl Monks concerning the following question:
where the 'xx' is a two-letter city abbreviation and the number is just a six digit ID number. What I then want to do is open the file, and store all the data in a array-of-a-hash-of-a-hash - I think. Honestly, I have a very difficult time with these types of structures. Here is what I am doing:xx_000000
Now, it seems like this should work correctly, but I can't tell if it does. First of all, is my approach correct? Secondly, if so, how would I print out everything that is in the @{$city_data{$city}{$id}} array? I know that this may be a simple question for most, and I have read everything I could find on PM and elsewhere about this subject, but I am still lost. Could someone please try to explain this to me, in detail if you wouldn't mind, so that hopefully the next time I have a problem like this I am not as lost as I am now? Thanks so much to all the gracious helpers out there (and to all who aren't so gracious, thanks anyway :-).my %city_data = (); my ($city, $id) = split(/_/,$filename); open(THIS,"$filename") or die; my @tmp = <THIS>; close(THIS); push @{ $city_data{$city}{$id} }, @tmp;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(Ovid) Re: Confused about complex data structures.
by Ovid (Cardinal) on Jan 18, 2001 at 05:14 UTC | |
by flocto (Pilgrim) on Jan 18, 2001 at 06:58 UTC | |
by r.joseph (Hermit) on Jan 18, 2001 at 05:24 UTC | |
by marius (Hermit) on Jan 18, 2001 at 21:22 UTC | |
|
Re: Confused about complex data structures.
by saucepan (Scribe) on Jan 18, 2001 at 05:13 UTC | |
|
(tye)Re: Confused about complex data structures.
by tye (Sage) on Jan 18, 2001 at 05:07 UTC | |
|
Re: Confused about complex data structures.
by arturo (Vicar) on Jan 18, 2001 at 05:05 UTC | |
by r.joseph (Hermit) on Jan 18, 2001 at 05:17 UTC | |
by arturo (Vicar) on Jan 18, 2001 at 05:25 UTC |