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

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' => '', '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.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (10)
As of 2018-03-22 12:29 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (274 votes). Check out past polls.