> 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", > } > }; > }
Almost got it! , change the = to => Since each key is a hash ref you want key => value_hashref, So then you do (or something similare, you'll have to read perldoc perlref and experiment) print ${{$thief_opt}{$layer}}{'type'}; HTH Dmuey > > ##--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] > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]