I'm not really up on Tk programming, but that validate command sub looks fishy. ;-)

-validatecommand => sub { $_[1] =~ /^[aAdDtTsSoOuU]*$/; },

Comments:

  1. Whitespace is your friend. Use some. ;-)
  2. Check out the perlre document on how regular expressions work. You don't list the characters in quotes, separated by commas. Think of regular expressions as an entirely separate language from perl. It really is. Mostly.
  3. You want to check that the entire string is made up of only DATSOU letters - so you need to match the whole string. ^ matches the beginning, $ matches the end. The string in between is made up of zero or more (specified by the *) of the characters in the brackets.
  4. You can also use /[datsou]/i - the i at the end says this is case insensitive. It is also usually slower, but it's more readable. This would be the way I'd usually go myself, but I also wanted to show you code that was as close to what you already had as I could.
  5. Hope that helps.


    In reply to Re: Changing the Textvariable of a restricted entry widget (TK) by Tanktalus
    in thread Changing the Textvariable of a restricted entry widget (TK) by Real Perl

    Title:
    Use:  <p> text here (a paragraph) </p>
    and:  <code> code here </code>
    to format your post, it's "PerlMonks-approved HTML":



  6. Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  7. Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  8. Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  9. Please read these before you post! —
  10. 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
  11. 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;
  12. Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  13. See Writeup Formatting Tips and other pages linked from there for more info.