use strict; use warnings; use Tk; my $mw = tkinit(); my @radiobuttons; my $var; for my $v( 1 .. 5 ) { my $rb = $mw->Radiobutton( -variable => \$var, -text => $v, -value => $v ); $rb->pack; push @radiobuttons, $rb; } $radiobuttons[3]->select; MainLoop;