>$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?

For one thing, at least in the case of scalar values, why are you loading the 
scalars in anonymous arrays?  Why not just have "con_name" => 
"$constraint_name" for example?  Also, you could only be clobbering previous 
contents if $table already exists in the overall hash.  Otherwise $table is 
created as a new key and there should be no problem.  So you need to use a 
check, something like

if (exists $tablename{$table}) {...next (or whatever)...}
else { $tablename{$table} = ... }

Check out chapter 9 of the Camel 3rd edition for how to load and access nested 
data structures.  In my opinion it just gets to be to much of a hassle after 3 
levels of nesting.  So try to re-think your approach if it's too much to deal 
with, or check out the various Data modules on CPAN.

Regards,

Nathanael Kuipers


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

Reply via email to