in reply to Write XML file
You could try an option of NoAttr => 1. That will help make it look right. In general I don't think that XML::Simple is suited well for cases where you want input and output to retain the same format.