hier script und dump... nach dem einlesen ist der key 'forms' weg, dafür gibts nen key 'name' mit value 'forms'
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
use strict;
use warnings;
use XML::Simple;
use Data::Dumper;
my @forms = qw(first second third);
my $tree;
my $vxml;
my $filename = 'vxml_tree.xml';
$vxml->{forms}->{$_} = ['dummy', { more_dummy => 'more' }] for (@forms);
$tree->{system_1} = $vxml;
print Dumper $tree;
my $xs = new XML::Simple();
my $xml = $xs->XMLout($tree);
open my $fh, '>', $filename or die $!;
print $fh $xml;
close $fh;
$tree = $xs->XMLin($filename);
print Dumper $tree;
...und die ausgabe
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
$VAR1 = {
'system_1' => {
'forms' => {
'first' => [
'dummy',
{
'more_dummy' => 'more'
}
],
'second' => [
'dummy',
{
'more_dummy' => 'more'
}
],
'third' => [
'dummy',
{
'more_dummy' => 'more'
}
]
}
}
};
$VAR1 = {
'system_1' => {
'first' => [
'dummy',
{
'more_dummy' => 'more'
}
],
'second' => [
'dummy',
{
'more_dummy' => 'more'
}
],
'third' => [
'dummy',
{
'more_dummy' => 'more'
}
],
'name' => 'forms'
}
};
\n\n
<!--EDIT|bo|1169736420-->