in reply to XML::Simple XMLout tag sorting
From personal Experience, XML::Simple is a collection of bugs flying in loose formation. I would recommend using another library such as XML::LibXML or my preference XML::Toolkit.
It's been a while so I don't remember the specifics, but I was attempting to use XML::Simple and was getting some really strange results when parsing my xml. Strange data structures being returned... etc. It was actually #perl-help on irc.perl.org that turned me onto XML::Toolkit; after the initial learning curve I'm glad I made the change.
anyway, that's my $0.02