Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Foreach hash of array

by TGI (Parson)
on Aug 05, 2008 at 17:50 UTC ( #702431=note: print w/replies, xml ) Need Help??


in reply to Foreach hash of array

You are getting a bad response because your questions are not clear and do not show any actual attempt to solve the problem.

You will get a better result if you clearly state what your goal is, show a sample of failed code, and describe the error/bad result from your attempt. Read the How (Not) to Ask a Question node linked elsewhere in the thread.

For example, if you had said, "I need to iterate over the array reference stored in the 'Fruits' key and find all cases where the grandchild key is 'Orange'. Here's what I've tried: ... some code goes here...", you would probably have an answer by now.

Your questions make giving you the answer you want impossible. Nobody really knows what you really want. Someone might hit on it in with a lucky guess, but do you want to rely on an improbable chance?

Here's where I take a guess at helping you. Your variable name is '$xml'. Are you getting this data structure from an XML file? It's a needlessly complex structure. What tools are you using to parse the XML? Maybe a different library would be helpful. There are tons of libraries for XML munging that may make solving your problem trivial. If the data doesn't come from an XML file, you may wish to change your variable name, and simplify the data structure.

Update: Take a look at Iterating over an array variable times for an example of an unclear question followed up by a good problem statement.


TGI says moo

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://702431]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2018-07-17 04:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (354 votes). Check out past polls.

    Notices?