$VAR1 = {
'link' => [
{
'rel' => 'alternate',
'href' => 'http://www.test.com'
},
{
'rel' => 'self',
'href' => 'http://www.test.com'
}
],
'xmlns' => 'http://www.w3.org/2005/Atom',
'entry' => {
'number=0001096906-13-000126' => {
'link' => {
'rel' => 'alternate',
'href' => 'http://www.test.com/1',
'type' => 'text/html'
},
'summary' => {
'content' => 'Green',
'type' => 'html'
},
'title' => 'Green Diamond',
'updated' => '2013-02-05T15:34:15-05:00',
'category' => {
'scheme' => 'http://www.test.com/',
}
},
'number=0001096906-13-000130' => {
'link' => {
'rel' => 'alternate',
'href' => 'http://www.test.com/2',
'type' => 'text/html'
},
'summary' => {
'content' => 'Green',
'type' => 'html'
},
'title' => 'Green Diamond',
'updated' => '2013-02-05T15:34:15-05:00',
'category' => {
'scheme' => 'http://www.test.com/',
}
},
'updated' => '2013-02-05T15:38:23-05:00',
'author' => {
'email' => 'webmaster@test.com',
'name' => 'Webmaster'
},
'id' => 'http://www.test.com',
'title' => 'Latest Colors - Tue, 05 Feb 2013 15:38:23 EST'
};
到目前为止,在我的代码中我有....
#!/usr/bin/perl
# use module
use XML::Simple;
use Data::Dumper;
# create object
$xml = new XML::Simple;
# read XML file
$data = $xml->XMLin("sec_rss.xml");
# print output
#print Dumper($data);
foreach $e (@{$data->{entry}[0]}) {
print $e->{link},"\n";
}
但是我对如何遍历这里的每个条目以获取元素感到困惑。有人可以给我一个线索来帮助我滚动吗?非常感谢!