Yeah, as rcseege demonstrated in their example, there really isn't a need for a variable to hold the checkbox widgets, so all you really need is

$bill_table->Checkbutton(-variable=>\$checkboxvalue[$t])->pack;

I'm assuming that somewhere in your code you increment $t, since this appears to be just a snippet, or hopefully just a badly put together example. Ideally you'd want to create and pack your checkbuttons seperate from the rest of the code. Something along the lines of the following:

my @checkbox = (qw/fred george jimbo frank/); foreach $c (0..@#checkbox) { $bill_table->Checkbutton(-variable=>\$checkboxvalue[$c],-text=>@chec +kbox[$c])->pack; }

Update: What you really need to do, to help us help you is trim it down to just what's causing the error, but with enough code that we can actually run the script, it's alot easier to debug something when we have a working program, with the smallest amount of code that still generates the same error you get. and as rcseege said, you may just find out what's wrong yourself when trying to trim it down to a functional test case.

Just Another Perl Alchemist

In reply to Re: Array of TK::Checkbuttons not acting appropriately by Koosemose
in thread Array of TK::Checkbuttons not acting appropriately by mikasue

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.