use strictures; use YAML "Load"; use XML::Simple "XMLout"; my $data = Load(do{ local $/; <DATA> }); print XMLout( $data, XMLDecl => 1 ); __DATA__ --- - fruits: - apple - pear - orange
There may be a combination of options for XMLout , which will be DWYW, and you may need to compress your data structure to get the root name you need, etc. You can note from a dizzying array of parameters that serialize and sort XML for other data formats is clearly not simple. Read: XML :: Simple and YAML .
source share