|
Hi,
I want to take an xml file and recognize a particular tag and print what is in between that tag.
How can I refer to something that is nested?
Example: Books.xml
<Books>
<Book>
<title>Perl Magic</title>
<author>Karthik</author>
<publisher>ORielly</publisher>
<price currency="Rupees" value="330"/>
</Book>
<Book>
<title>Perl for Dummies</title>
<author>Mark</author>
<publisher>ORielly</publisher>
<price currency="Rupees" value="420"/>
</Book>
</Books>
Perl script : books.pl
use XML::Simple;
use Data:: Dumper;
$xml = new XML::Simple;
$data = $xml->XMLin("books.xml");
print "$data->{author} is the author of $data->{title} and it is published by $data->{publisher}\n"
I'm not getting the correct output for this. What am I missing?
|