G'day boscaiolo,

Welcome to the monastery.

Unfortunately, as already pointed out, your post is lacking various pieces of information that would help us to help you. In addition to a lack of details about the input data, there's no concrete indication of your expected output or what, if anything, you've already tried and perhaps had difficulties with. Furthermore, you've provided no links to information you've made reference to: I could probably work out where Curses::UI is documented but I shouldn't have to; I've got absolutely no idea what "tutorial" you're referring to — please read "What shortcuts can I use for linking to other information?".

From the information you have provided, I suspect your code would look something like this:

my @list_of_files = qw{File Edit Help}; my $regex_to_match_label = qr{LABEL="([^"]+)}; my @menu; for my $filename (@list_of_files) { open my $fh, '<', $filename or die "Can't read $filename: $!"; my @submenu; push @menu, { -label => $filename, -submenu => \@submenu }; while (<$fh>) { if (/$regex_to_match_label/) { my $label = $1; push @submenu, { -label => $label, -value => sub { generic_dialog($la +bel) } }; } } close $fh; }

-- Ken


In reply to Re: trying to populate curses menus from text files by kcott
in thread trying to populate curses menus from text files by boscaiolo

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.