http://www.perlmonks.org?node_id=1002797

perltux has asked for the wisdom of the Perl Monks concerning the following question:

This is the scenario:

I have a few arrays (here it's three but in reality I have more):
@preset = qw(tom snare metal analog); @card1 = qw(mellowstr brightstr string3); @ram = qw(acoustic rock bass jazz strato distorted);

now I want to have two interdependent PerlTK BrowseEntry widgets:

The first one should let me choose one of the arrays (preset or card1 or ram), while the second one will let me choose one of the elements from the array chosen in the first BrowseEntry widget.

The BrowseEntry widget needs an array as 'choices' parameter and saves the choice in a string variable.

What I'm struggling with is how to create a suitable data structure for this, I was trying with an additional hash of arrays like this:

%hash=(preset=>\@preset, card=>\@card1, intram=>\@ram);
But first of all I'm not sure if that is the best way to do this and then I'm struggling to make this work (I can't figure out what to assign to -choices in the two BrowseEntry widgets).

It would be a huge help for me if someone could tell me the best data structure for this and the -variable and -choices parameters required to make this work (ideally with actual code snippets, based on my example).

If this problem description sounds confusing that's because I am confused! :-)