I am trying to run a Perl script to get all the elements of an xml document into an array. The code is as follows:
#!/usr/bin/perl
# Script to illustrate how to parse a simple XML file
# and dump its contents in a Perl hash record.
use strict;
use XML::Simple;
my $xs = new XML::Simple();
my $booklist = $xs->XMLin('./cmn_msg.xml');
print Dumper($data);
When I run this code, I get an error:
Use of tied on a handle without * is deprecated at C:/Perl/lib/XML/Parser/Expat.pm line 447.
not well-formed (invalid token) at line 4, column 14, byte 128 at C:/Perl/lib/XML/Parser.pm line 187
I am using ActivePerl (v5.14.1) built for MSWin32-x8开发者_如何学编程6-multi-thread. I am trying to run this script on Win7.
But when I run this code, I get an error: Use of tied on a handle without * is deprecated at C:/Perl/lib/XML/Parser/Expat.pm line 447.
That sounds like a warning, rather than an error. You have an out of date install of XML::Parser:.
not well-formed (invalid token) at line 4, column 14, byte 128 at C:/Perl/lib/XML/Parser.pm line 187
That says your XML is broken. You need to correct the XML.
The warning actually comes from an out of date XML::Simple module:
http://www.nntp.perl.org/group/perl.perl5.porters/2011/04/msg171611.html
精彩评论