in reply to XML module which one
Nodding in assent to the foregoing ... it is almost-100% likely that this simple and lightweight module will be exactly what you need. Definitely you should choose some XML-handling module, and delegate to it the task of preparing the XML-string for delivery. (Never try to “do it yourself.” Bad dog... no biscuit!) Obviously, there are many XML-handling packages available in Perl, but this one should be entirely adequate for anything that CGI could possibly deliver.