tlemons has asked for the wisdom of the Perl Monks concerning the following question:
I'm a Perl newbie with the following task: I need to take a very long string and parse the elements of that string. The string will contains multiple occurrences of:
Dog: Beagle
Food: Type 3
Dog: Retriever
Food: table scraps
The string will have a bunch of unneeded text before and after these multiple occurences. After I parse the elements, I want to put them into a data structure. I want to group each 'Dog' - value together, and each 'Food' - value together. I also want to group each 'dog/food' pair together. I will retrieve the this information later based on the Dog value.
I think I want to use a hash of hashes. I've been reading the appropriate parts of 'Programming Perl' (which is great), but I would appreciate a nudge in the right direction, as none of the examples matches my case closely enough for me to see a solution.
Thanks!
tl
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Creating data structure from multiple pairs of information
by RazorbladeBidet (Friar) on Feb 17, 2005 at 18:02 UTC | |
|
Re: Creating data structure from multiple pairs of information
by Fletch (Bishop) on Feb 17, 2005 at 18:01 UTC | |
|
Re: Creating data structure from multiple pairs of information
by jcoxen (Deacon) on Feb 17, 2005 at 18:07 UTC | |
by Grundle (Scribe) on Feb 17, 2005 at 19:37 UTC | |
by RazorbladeBidet (Friar) on Feb 17, 2005 at 19:47 UTC |