use XML::Simple qw(:strict); #### use strict; use XML::Simple qw(:strict); my $xml =q( 0596001320 Learning Perl, 3rd Edition Randal L. Schwartz Tom Phoenix 1565922204 Advanced Perl Programming Sriram Srinivasan 076455106X Guitar for Dummies Mark Phillips John Chappell ); my $library = XMLin($xml); foreach my $book (@{$library->{book}}) { print "$book->{title}\n"; print " $_\n" foreach(@{$book->{author}}); } #### No value specified for 'forcearray' option in call to XMLin() at ./stricttest.pl line 26 #### my $library = XMLin($xml, forcearray => [ qw(book author) ]); #### No value specified for 'keyattr' option in call to XMLin() at ./stricttest.pl line 26 #### my $library = XMLin($xml, forcearray => [ qw(book author) ], keyattr => { book => 'isbn' } ); print $library->{book}->{1565922204}->{title}, "\n"; #### my $library = XMLin($xml, forcearray => [ qw(book author) ], keyattr => [] ); #### Learning Perl, 3rd Edition Randal L. Schwartz Tom Phoenix Advanced Perl Programming Sriram Srinivasan Guitar for Dummies Mark Phillips John Chappell #### my $library = XMLin($xml, forcearray => [ qw(author) ], keyattr => { book => 'isbn' } ); print $library->{book}->{1565922204}->{title}, "\n"; #### set in keyattr but not in forcearray at ./stricttest.pl line 26