You can use $writer->dataElement( 'Name', $Name[0]); to generate <Name>Fred Flintsone</Name> and replace 3 lines in your code. This would shorten it and make it a lot more clear.
I tend to dislike using the IO::File thing and write to STDOUT instead (just don't use the OUTPUT argument and redirect the output of your script) but maybe that's just me.
In reply to Answer: Help with XML::Writer by mirod
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |