Richard Lee schreef: > how do I parse out > > <image src="http://www.oreilly.com/catalog/covers/perlbp.s.gif" > width="145" height="190" /> > > I tried $book->{image}->{src}... but doesn't work.. > > use XML::Simple qw(:strict); > > my $library = XMLin($filename, > ForceArray => 1, > KeyAttr => {}, > ); > > foreach my $book (@{$library->{book}}) { > print $book->{title}->[0], "\n" > > } > > XML file > > <library> > <book> > <title>Perl Best Practices</title> > <author>Damian Conway</author> [...] > </book> > </library>
You can easily convert the above code to a small-but-complete Perl script, for example with the XML-data in the __DATA__ section, and use Data::Dumper at several stages to show you the data structures. -- Affijn, Ruud "Gewoon is een tijger." -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/