Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: How do I parse values of a complex anonymous hash of hashes?

by epoptai (Curate)
on May 07, 2001 at 15:00 UTC ( #78470=note: print w/ replies, xml ) Need Help??


in reply to How do I parse values of a complex anonymous hash of hashes?

It's hard to answer this question without seeing the data structure, but here are a few clues.

Use Data::Dumper to see what the hash looks like:

use Data::Dumper; print header('text/plain'); print Dumper($foo);
If you use forcearray when parsing the XML:
$foo = XMLin($xml, forcearray => 1);
Then you can access the data in a structure like this (which is exactly what Dumper prints):
$foo = { 'INFO' => [ { 'lastchecked' => '20010506070758', 'content' => 'Rendered by the Newest Nodes XML Generator' +, 'site' => 'http://perlmonks.org', 'sitename' => 'Perl Monks' } ] };
With loops like this:
if(defined @{$data->{'INFO'}}){ for my $when(@{$data->{'INFO'}}){ $lastcheck = $when->{'lastchecked'} } }

Super search around perlmonks a bit for more info.


Comment on Re: How do I parse values of a complex anonymous hash of hashes?
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2015-07-05 05:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (60 votes), past polls