I could not think of a way to search this or any other forum/search engine for a question like this.
I have a configuration file that contains fields that are actually the of "fields" in a hash. (Actually a json hash but that's besides the issue at hand.) These will correspond with positional parameters supplied at run-time. For example, here re a couple of lines; each is a set of fields, comma separated:
(I do need to protect the private data of my client.)name,address-virtual-email movie-role,hoig-boig-loig-shmoig
The first line requires that I plunk a value into:
The second line tells to plunk run-time values intoo $js->{name} # This is the easy part o $js->{address}{virtual}{email} # Here's the trouble
There are dozens of such lines in the config file and there's no telling what they will add to the list. So I'm racking my brains out for a way to address the substructures (using the term loosely) in a dynamic fashion. I can certainly combine the string $compound = "{hoig}{boig}{loig}{shmoig}" but it won't help me to address js=>{$compound} because that is just a string and there is no such key in the hash.o $js->{movie}{role} # In this example o $js->{hoig}{boig}{loig}{shmoig} # both are trouble!
Can anyone come up with a way to get at the nested fields in the hash when I can't know in advance which keys (and sub-keys) I will need to address? I don't believe the symbol table will help here; the keys of the hash (and all its sub-hashes) are not in the symbol table (I think).
Thanks! Gracias! Spasiba! Szepem Köszönöm!
-- RP
In reply to Dynamic addressing in a hash by rpaskudniak
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |