use warnings; use strict; use Tk; my %w; $w{mw} = MainWindow->new; my $col = 0; for my $cb ( 1 .. 5 ) { $w{cb}{$cb} = $w{mw}->Checkbutton( -text => $cb, )->grid( -row => 0, -column => $col++ ) } $w{cba} = $w{mw}->Checkbutton( -text => 'All', -command => sub{ for ( values %{$w{cb}} ) { $w{cba}->{'Value'} ? $_->select : $_->deselect } }, )->grid( -row => 0, -column => $col++ ); MainLoop;