Somewhere in Main application call the dirtree_sub below to choose a working area. Once user select the work area through dirtree, it will set the path in $area entry box. But when I add $dirtree_frame->destroy in dirtree_sub below, it print warning:

Useless use of reference constructor in void context at geometry_place +.pl line 564. Useless use of reference constructor in void context at geometry_place +.pl line 570.

Any idea how to solve this?

Some code in main application:

my $area = $mw->Entry(-background => "white", -foreground => "black", +-width => 51)->place(-x=>100, -y=>$ystart + 60); $area->insert('end', "$workarea"); sub dirtree_sub { if ($area->get() ne "") { $CWD = $area->get(); } else { $CWD = Cwd::cwd(); }; my $dirtree_frame = $mw->Toplevel; $dirtree_frame->title("Select work area"); my $DIR_TREE = $dirtree_frame->Scrolled('DirTree', -scrollbars => "osoe", -width => 50, -height => 25, -exportselection => 1, -browsecmd => sub {$CWD = shift}, -command => sub {\&show_cwd(); $dir +tree_frame->destroy})->pack(-fill => "both", -expa +nd => 1); $DIR_TREE->chdir($CWD); my $button_frame = $dirtree_frame->Frame()->pack(-side => "bottom" +); $button_frame->Button(-text => "Ok", -command => sub {\&show_cwd(); $dirtree_fram +e->destroy})->pack(-side => "left"); $button_frame->Button(-text => "Exit", -command => [$dirtree_frame=>'destroy'])->pa +ck(-side => "left"); }; sub show_cwd { $area->delete('0.0', 'end'); $area->insert('end', $CWD); }

In reply to Useless use of reference constructor in void context by myfamilygeneral

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.