good chemistry is complicated,
and a little bit messy -LW
data structure problemby perltux (Scribe)
|on Nov 08, 2012 at 03:11 UTC||Need Help??|
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):
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! :-)