use Tk; my $mw = Tk::MainWindow->new; my $txt = $mw->Label(-text=>"Value:"); $txt->pack; $mw->Button(-text=>"Ok", -command=>sub {$txt->configure(-text=>"Value: " . rand)})->pack; srand (time | $$); $mw->MainLoop;