我正在尝试运行 Perl 脚本以将 xml 文档的所有元素放入数组中。代码如下:
#!/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);
当我运行这段代码时,我得到一个错误:
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
我正在使用为 MSWin32-x86-multi-thread 构建的 ActivePerl (v5.14.1)。我正在尝试在 Win7 上运行此脚本。