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