in reply to XML::Simple Array bombs out with 1 Item in document
Hmm ... well ... once you get paste the dodgy use of eval (do you really need to do that ... probably not). Basically the core problem is your data structure is not a hash of hashes but a hash of arrays of hashes.
but you're probably better of just using XML::RSS:foreach my $e ( @{$data->{channel}[0]{items}} ) { ... print $e->{title}[0] ... }
my $rss = XML::RSS->new( version => '2.0' ); my $rss->parse( $rss_xml ); # print the title and link of each RSS item foreach my $item ( @{$rss->{items}} ) { print "title: $item->{title}\n"; print "link: $item->{link}\n"; print "desc: $item->{description}\n"; }
-derby
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: XML::Simple Array bombs out with 1 Item in document
by Anonymous Monk on Jun 14, 2012 at 19:46 UTC | |
by Anonymous Monk on Jun 14, 2012 at 20:00 UTC |
In Section
Seekers of Perl Wisdom