use Tk; use strict; my @cbValues; my $mw = MainWindow->new; $mw->Button( -text => "Print Selected", -command => \&printSelected )->pack; my $rows = $mw->Frame->pack; ## $rows will serve as a gridded container for each ## of the checkbutton rows. This should be roughly ## similar to using Tk::Table, but less hassle ## for a quick & dirty example. for my $row (0 .. 9) { $rows->Checkbutton( -text => $row, -variable => \$cbValues[$row] )->grid( $rows->Button( -text => "Submit", -command => sub { if ($cbValues[$row] == 1) { print "$row selected\n" } else { print "$row unselected\n"; } })); } MainLoop; sub printSelected { my $row = 0; print "\nSelected:\n"; foreach my $val (@cbValues) { print "$row selected\n" if $val; $row++; } }