in reply to XML::Simple hash tree structure not consistent

I can't seem to get XML:Simple to create a hash tree the same way for different data. If there are two entries in my tree then I get named hashes of named hashes. If the XML only has one entry then the structure changes. How do I force the same structure all the time?

That's pretty common in XML::Simple usage and the reason why there's ForceArray (see this section).

XMLin($xml, ForceArray => [ qw(state project) ] );
The names in ForceArray stand for those tags which should always be transformed into array refs, no matter if only one appears. It is all explained in the fine documentation, including this FAQ.