When I run this code:
use strict; use warnings; use XML::Simple; my $associate = XMLin('./amazon.xml', forcearray=>0); my $books = $associate->{books}->{item}; my $cds = $associate->{cds}->{item}; my $dvds = $associate->{dvds}->{item}; my $wish = $associate->{ wish}->{item}; foreach my $books (values %$books) { print "$books->{'asin'} \n"; }
I get this error:
Out of memory!
Here is my XML file:
<associate> <books> <item item_name="Mysql and Perl for the Web" asin="0735710546" + /> <item item_name="Macromedia Flash MX: Training from the Source +" asin="0201794829" /> <item item_name="XSLT" asin="0596000537" /> <item item_name="Learning XML" asin="0596000464" /> <item item_name="Programming Perl (3rd Edition)" asin="0596000 +278" /> <item item_name="Network Programming with Perl" asin="02016157 +11" /> <item item_name="Cisco Networking Academy Program: Fundamental +s of UNIX Companion Guide" asin="1587130440" /> </books> <dvds> <item item_name="Gladiator (2000)" asin="B00003CXE7" /> <item item_name="The Princess Bride (Special Edition) (1987)" +asin="B00005LOKQ" /> <item item_name="Pi" asin="078401213X" /> </dvds> <cds> <item item_name="OK Computer (Radiohead)" asin="B000002UJQ" /> <item item_name="Pablo Honey (Radiohead)" asin="B000002UR7" /> <item item_name="Parachutes (Coldplay)" asin="B0000508U6" /> <item item_name="Hatful of Hollow (The Smiths)" asin="B000002M +IF" /> </cds> <wish> <item item_name="The Usual Suspects (Special Edition) (1995)" +asin="B00005V9HH" /> <item item_name="How to Win Friends and Influence People" asin +="0671723650" /> <item item_name="ActionScript for Flash MX: The Definitive Gui +de, Second Edition " asin="059600396X" /> </wish> </associate>
In reply to 'Out of memory!' Error with XML::Simple by silent11
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |