Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I have a hash that I populate by extracting data from an xml file.
At some point in my script the following assignment is made
Just a note that every $parentid has many children. Now I want to get just the values of each child for a certain parent. I thought that the code below would work, but it does not:
neither does this:
How do I get the key values for the first branch (parent id) of the hash? I hope my question makes sense.
Thank you
At some point in my script the following assignment is made
$children{$parent_id}{$child_id}{'id'} = $newid;
Just a note that every $parentid has many children. Now I want to get just the values of each child for a certain parent. I thought that the code below would work, but it does not:
@{ $children{$parent_id} });
neither does this:
keys($children{$parent_id})
How do I get the key values for the first branch (parent id) of the hash? I hope my question makes sense.
Thank you
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Trying to pull the key values from a Hash
by bellaire (Hermit) on Nov 24, 2009 at 15:20 UTC | |
Re: Trying to pull the key values from a Hash
by BioLion (Curate) on Nov 24, 2009 at 15:53 UTC | |
by JadeNB (Chaplain) on Nov 24, 2009 at 16:43 UTC | |
by BioLion (Curate) on Nov 25, 2009 at 10:22 UTC | |
Re: Trying to pull the key values from a Hash
by planetscape (Chancellor) on Nov 24, 2009 at 20:34 UTC | |
Re: Trying to pull the key values from a Hash
by biohisham (Priest) on Nov 24, 2009 at 16:14 UTC |
Back to
Seekers of Perl Wisdom