in reply to how to get attribute values and store in a hash.

It also might be practical to parse the XML file using one of the many available CPAN power-tools, and then use that file directly as your data source instead of munching things into hashes.   In any case, devise a Perl object (or objects ...) that will “give you the answers you’re looking for, never mind just how.”   Otherwise such code can get really messy really quick, especially if it winds up retaining large amounts of data “in memory” and thus taking a trip to Virtual Memory Thrashing Hell.