in reply to Perl and XML

The syntax where you declare %Fields is immediately suspect. What exactly do you expect, for example, Type => 'A'{ to produce as a data structure?

Perhaps a review of perldsc, perlref, and perlreftut would help you with that. While you're at it, you might want to look at perlstyle.