我有一个使用XML::Parser
Perl 模块解析的 XML 文件。解析 XML 的代码:
..........................................
$parser = XML::Parser->new(Style => 'Tree');
$my_map = $parser->parse($xml);
print Dumper($my_map->[1]) . "\n";
声明结果print Dumper($my_map->[1])
:
$VAR1 = [
{},
0,
'
',
'lfs',
[
{
'name' => 'ABC'
},
0,
'
',
'FS',
[
{
'status' => '1',
'acc' => '/tmp',
'kind' => 'ass'
}
],
0,
'
'
],
0,
'
',
'lfs',
[
{
'name' => 'BCG'
},
0,
'
',
'FS',
[
{
'status' => '1',
'acc' => '/home/tmpspace/tmp1',
'kind' => 'oops'
}
],
0,
'
',
'FS',
[
{
'status' => '1',
'acc' => '/home/tmpspace/tmp2',
'kind' => 'hops'
}
],
0,
'
'
],
0,
'
',
'lfs',
[
{
'name' => 'KMN'
},
0,
'
',
'FS',
[
{
'status' => '1',
'acc' => '/misc/ib',
'kind' => 'nops'
}
],
0,
'
'
],
0,
'
',
'lfs',
[
{
'name' => 'MAIN'
},
0,
'
',
'FS',
[
{
'status' => '1',
'acc' => 'This is the string that I wanted.',
'kind' => 'mount'
}
],
0,
'
'
],
0,
'
'
];
从$my_map->[1]
,我想得到'acc' => 'This is the string that I wanted.'
。如何'acc' => 'This is the string that I wanted.'
有效地获取?