http://qs1969.pair.com?node_id=543825


in reply to How to create HASH with multiple values per Key

You just need to make the hash value a reference to the Property array. The only question I would have in the matter is what if @Object had multiple values?

Replies are listed 'Best First'.
Re^2: How to create HASH with multiple values per Key
by gasho (Beadle) on Apr 17, 2006 at 14:48 UTC
    I am looping through a file that contains both Objects and Properties and storing Objects in @Objects and Properties of particular Object in @Properties e.g of the file
    <AllObjectsProperties> <Object name="O1"/> <Properties> <Prop name="P1"/> <Prop name="P2"/> <Prop name="P3"/> </Properties> <Object name="O2"/> <Properties> <Prop name="S1"/> <Prop name="S2"/> <Prop name="S3"/> </Properties> </AllObjectsProperties>
      XML::Simple or one of the other XML modules may suit your needs and save you the parsing/looping/data structure creation.