>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};


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to