I've just noticed that a string containing square brackets causes a fatal error when configuring a label. Eg:
my $lab = '8 million ways to die (1986)[HD].TAG'; $menu_item->configure(-label=>$lab, ... );
gives:
Tk::Error bad menu entry index "8 million ways to die (1986)[HD]" at / +<path>/i368-linux-thread-multi/Tk.pm line 250 (caused by) Tk::Menu::Item::configure at /<path>/i368-linux-thread-multi/Tk/Menu/I +tem.pm line 63 ...
The actual strings are user supplied file names which are being used in a MRU list so my temporary fix is to change any square braces into brackets for display purposes in the MRU menu list, but if someone can think of a workaround to configure the menu item label with the 'correct' string, I'd appreciate it. BTW, I can create the menu item with the '[]' chars no problem:
$menu_item = $menu_file->command(-label=>$lab, ...);
It's just when I configure an item (using $item->configure(...) duh) that the problem occurs. I'm half inclined to call it a bug?

In reply to Valid chars for Tk Label by ron7

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.