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! :-)

In reply to data structure problem by perltux

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.