senik148 has asked for the wisdom of the Perl Monks concerning the following question:
anybody....?$data->{channel}->{item}->[0]->{title}; $data->{channel}->{item}->[1]->{title}; $data->{channel}->{item}->[2]->{title}; $data->{channel}->{item}->[3]->{title};
#!/usr/bin/perl # import packages use XML::Simple; use LWP::Simple; # initialize object # get RSS data $raw = get('http://movies.go.com/xml/rss/intheaters.xml'); # create object $xml = new XML::Simple; $data = $xml->XMLin($raw); $title = $data->{channel}->{item}->[0]->{title}; $link = $data->{channel}->{item}->[0]->{link}; $description = $data->{channel}->{item}->[0]->{description}; print "Title: $title\n"; print "Link: $link\n\n"; print "Description: $description\n";
2005-12-20 Retitled by planetscape, as per Monastery guidelines
Original title: 'XML::Parser'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: XML::Parser - element data to hash?
by duff (Parson) on Dec 20, 2005 at 23:25 UTC | |
|
Re: XML::Parser - element data to hash?
by qq (Hermit) on Dec 21, 2005 at 00:25 UTC | |
by senik148 (Beadle) on Dec 21, 2005 at 17:24 UTC |