http://www.perlmonks.org?node_id=23443


in reply to Using Perl to create XML

Answer: subclass XML::Parser. Take a look at XML::RSS for a good exmaple of subclassing XML::Parser. OO is your friend. Sorry I can't give an example here as it would be quite involved.

local $_ = "0A72656B636148206C72655020726568746F6E41207473754A"; while(s/..$//) { print chr(hex($&)) }