#input file
name subname start size
CAL_M reserved 0 13
CAL_M o_check_out 13 7
CAL_M o_ttr_first 20 4
CAL_M o_cal_check_1 24 4
PSQN_0 reserved 0 8
PSQN_0 check_final 8 10
PSQN_0 o_check 18 10
####
#expected output file
####
#current output file
####
#input file
open (FILE,";
close (FILE);
#output file
my $output_file = "myfile.xml";
my $output = new IO::File(">$output_file");
my $writer = new XML::Writer(OUTPUT=>$output, DATA_MODE=>1, DATA_INDENT => 2);
#structure
foreach my $item(@array)
{
chomp($item);
$item =~/(\w+),(\w+),(\d+),(\d+)/;
my $name =$1;
my $sname=$2;
my $start=$3;
my $size =$4;
$writer->startTag("structure", "name"=>$name);
$writer->startTag("value", "type"=>$size, "name"=>$sname, "start"=>$start);
$writer->endTag();
$writer->endTag();
}
$writer->end();
$output->close();