$xml_out = new IO::File(">$filename"); # 'OUTPUT' writes to this file # 'DATA_MODE' writes after each line # 'DATA_INDENT' indents each level four spaces $xml_writer = new XML::Writer( OUTPUT => $xml_out, DATA_MODE => 'true', DATA_INDENT => 4 );