What you have is a hash of hashes, the values of which is a reference to a
hash of arrays.  The original scalar is a reference to an anonymous hash.
The value of each hash key is a reference to an anonymous array.  The reason
why what you tried doesn't work is that you are assigning a reference to a
new anonymous hash instead of adding to the one you have.  Try something
like this:

%{$tablename{$table}}{con_name} = [$constraint_name];

or

$tablename{$table}->{con_name} = [$constraint_name];

The first example dereferences the anonymous hash and then accesses the key,
and the second one accesses the key indirectly (and is easier to read IMHO).

One question, though.  Why are you creating anonymous arrays that have only
one element?

Couldn't "table_name => [$table]" be more easily written as "$table_name =>
$table"?

-----Original Message-----
From: Ken Hammer [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 30, 2002 8:24 AM
To: [EMAIL PROTECTED]
Subject: What Type Of Data Structure Is This?



 A strange question.

 I'm using the following data structure to
store information from a data base query:

$tablename{"$table"} = {
                "table_name"    => ["$table"],
                "index_name"    => ["$index_name"],
                "columns"       => ["@column_name"],
                "type"          => ["$index_type"],
                "tablespace"    => ["$tablespace_name"]

 This works great and I can later extract the info
from this structure. I have 2 questions. What type of
structure is this and how do I add to it?

 When I try to add more info from a subsequent query like
this:

$tablename{$table} = {
                "con_name"      =>  ["$constraint_name"],
                "con_type"      =>  ["$type"],
                "rem_con_name"  =>  ["$r_constraint_name"],
                "created_by"    =>  ["$generated"]
            };

 I lose all the previous information, so that only the above
is now stored.
 What have I done, how do I do what I want, and am I in over my head?

-- 
Ken

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

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

Reply via email to