Hi Peter, Thanks a lot. That was really useful.
Do you know where I can more information on referencing and dereferencing of array elements on the web. I suspect I may have lot of problems without understanding the concept clearly. Regards, Sharat >From: "Peter Cornelius" <[EMAIL PROTECTED]> >To: "Sharat Hegde" <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> >Subject: RE: List of Associative Arrays >Date: Mon, 17 Dec 2001 20:56:45 -0800 > > > >I initiatize the list with: > > @MainList = (); > >Looks good. > > >To add elements, I am doing: > > push(@MainList, [%ElementAssocArray]); > >Not quite right. Loose the square brackets and take a reference to the >hash. > >push (@MainList, \%ElementAssocArray); > > >To access each element (for example the 1st element), I plan to do: > > %myElement = %MainList(0); > >You will need to use the square brackets here for an array index, not >parens. And you will need to add a dereference to the hash from above. > >%myElement = %{$MainList[0]}; > > >To access elements in the associative element list, I will do: > > $myAge = %myElement{"Age"}; > >Almost. Perl currently has this interesting concept that the sigil (the >leading character in a variable name) should indicate the data type being >accessed. That means a hash may be %hash, but a hash element is, by >definition, a scalar so it turns into $hash{key}. You also don't need to >double quote a string when it's a hash key. So try: > >$myAge = $myElement{Age}; > _________________________________________________________________ Chat with friends online, try MSN Messenger: http://messenger.msn.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]