Greetings,

I am attempting to make a hash of hashes or something equivalent but can't
seem to get it working properly.  Here is what I have so far:

@name = ("one", "two", "three");

Foreach my $layer (@name) {
        $thief_opt = {
                $layer = {
                        type            => "solid",
                        origin          => "datum",
                        use_arcs        => "yes",
                }
        };
}

##--for test purposes simply print the vars for now

while (($key, $val) = each %$thief_opt) {
        while (($key2, $val2) = each %$val) {
                print "$key $key2 $val2;
        }
}


I am trying to create a HoH that is called %thief_opt and who's first key is
based on a list contained in an array called @name.  This bit of code seems
to work and create a HoH with the structure I want, but the problem is that
every iteration of my foreach loop steps on the previous values for
%thief_opt so that in the end I only get a HoH for the last value in @name
(which in this case is "three"). 
 To try and explain it another way,  I have a list inside of @name that
might be something like: one, two, three.  I want to make a HoH that would
look more like the following if the values of @name were constants and could
be hard coded:

$thief_opt = {
        one = {
                type            => "solid",
                origin          => "datum",
                use_arcs        => "yes",
        },
        two = {
                type            => "solid",
                origin          => "datum",
                use_arcs        => "yes",
        },
        three = {
                type            => "solid",
                origin          => "datum",
                use_arcs        => "yes",
        },
}

I would appreciate any ideas or suggestions.

Best Regards,

Robert Zielfelder









.-.  --..

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

Reply via email to