Okay, Tye, I'll post it. I hope this helps. I'll try to explain the problem more in depth. I have two optionmenus and I want them to interact -- one of them contains directories, the other contains files (certain files connected to that directory).

I created a callback on the option menu that holds the directory, but apart from other problems during testing yesterday, doday I'm getting an error message: Can't use string "string here" as a HASH ref. Here's the code, some things, of course, taken out.

sub generate_options { ... opendir(DIR,$_[0]->{base}); my @subdirs = grep /[Tt][Ss]\d+/, readdir(DIR); closedir(DIR); ... my $nb = $mw->NoteBook->grid; ... for(1..$_[0]->{conds}) { $page->[$_-1] = $nb->add("Page$_", -label => "Condition $_") } for(1..$_[0]->{conds}) { ... my $dom = $page->[$_-1]->Optionmenu( -variable => \$info->{subdir}->[$_-1], -options => [@subdirs], ); my $fom = $page->[$_-1]->Optionmenu( -variable => \$info->{file}->[$_-1], -options => get_files ($_[0]->{base},\@subdirs, 0), ); # This here is where I get into trouble: $info->{subdir}... # is spitting out hash ref error described above $dom->configure(-command => sub { $fom->configure(-options => get_files($_[0]->{base},$info->{subdir}->[$_-1])) }); my $b = $page->[$_-1]->Button( -text => "Set", -command => [\&record, { info => $info, indx => $_-1 } +], ); ... $dom->grid( $fom ); ... } ... } sub get_files { opendir(DIR,$_[0] . '\\' . $_[1]->[$_[2]]); my @files = grep /.txt$/, readdir(DIR); closedir(DIR); return [@files]; }

In reply to Can't use string as HASH ref by dimmesdale

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.