Some food for thought :)

Why don't you use Tk::Menu? There is example at widget - Demonstration of Perl/Tk widgets, Menus : 1. Menus and cascades (sub-menus)

Why don't your functions/subroutines take arguments? Why do they work on "global" variables?

Slapping "my $globalvariable" on $globalvariable is not in the spirit of strict, but passing( $variables, $around, is( $in, $thespirit, $of, $strict ) );

 strict itself confers no benefits; The benefits come from avoidance of the bad practices forbidden by  strict :)

Write function, functions that take arguments, functions that return values, functions that don't operate on global variables , but functions that pass variables around
Examples Re: Tk: Creating label in hash

Start reading at Re^2: Border-less main window (Alt+F4 Ctrl+C and follow through to examples Re: Perk Tk - how to send a value from a subroutine back to the main program using Button (without MainLoop), Re: Perl tk FindNext in a text widget, Confused by variable scope in Tk::Wizard

If you're not convinced by what I'm saying read these links

bugs in HTML::TableExtract,
Tutorials: Variable Scoping in Perl: the basics,
Coping with Scoping , Mini-Tutorial: Perl's Memory Management,
Lexical scoping like a fox,
Read this if you want to cut your development time in half!,
Closure on Closures , perlref#Circular References,
Memory leaks and circular references,
Circular references and Garbage collection.,
make perl release memory,
about memory management , Re^3: Scope of lexical variables in the main script , Re: What's the weaken here for?,
Devel::Cycle,
Devel::NYTProf,
Devel::Leak Devel::LeakTrace,
WeakRef


In reply to Re: TK Submenus (Tk::Menu , global variables/ spirit of strict) by Anonymous Monk
in thread TK Submenus by PilotinControl

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.