in reply to Ill-formed hash of hash - to convert text to xml
Tip #1 from the Basic debugging checklist. Your code generates warning messages when you use warnings. Fixing those is a good place to start.