My input file is
TBLA COLA A B
TBLA COLB D E
TBLB COLX M N
TBLB COLD A B
TBLC COLD A B
The output to be created in xml format as
<Data>
<TBLA>
<COLA>
<oldvalue>A</oldvalue>
<newvalue>B</newvalue>
</COLA>
<COLB>
<oldvalue>D</oldvalue>
<newvalue>E</newvalue>
</COLB>
</TBLA>
<TBLB>
<COLX>
<oldvalue>M</oldvalue>
<newvalue>N</newvalue>
</COLX>
<COLD>
<oldvalue>A</oldvalue>
<newvalue>B</newvalue>
</COLD>
</TBLB>
<TBLC>
<COLD>
<oldvalue>A</oldvalue>
<newvalue>B</newvalue>
</COLD>
</TBLC>
</Data>
Can anyone suggest what would be the best way to do this. Should i convert this text file to hash of hashes first and then try using pltoxml(). does this make sense. Can XML::Simple or XML::Writer suffice this.
This is the first time I am working on xml and not sure which approach will help efficicently my solution.
A small example wrt to my req would be appreciated.
*Input file will always be sorted on first field
TBLBelement contains aCOLXnode, where the input hasCOLA. Is this a feature or a bug? Please also define behaviour when the input is not sorted. E.g how would the additional linesTBLA COLA A B\nTBLC COLA 1 2change the output?