in reply to
Creating nested elements in XML::Smart
This seems to work:
use strict;
use warnings;
use XML::Smart;
my @pp=qw(Puebla01 Puebla02);
my @shelf=qw(7480 7440);
my @comment=("ATM Core switch","ATM access switch");
my $XML = XML::Smart->new() ;
my $count=0;
foreach (@pp){
$XML->{Shelf_Info}{switch}[$count]{Name} = "$_";
$XML->{Shelf_Info}{switch}[$count]{shelfType} = $shelf[$count];
$XML->{Shelf_Info}{switch}[$count]{shelfType}->set_node(1);
$XML->{Shelf_Info}{switch}[$count]{commentText} = "$comment[$count
+]";
$XML->{Shelf_Info}{switch}[$count]{commentText}->set_node(2);
$count++;
}
$XML->save('test.xml') ;
It seems to want array refs to iterate over nodes.