#!/usr/bin/perl -w use strict; use Tk; my $mainwindow = MainWindow->new(); my $label = $mainwindow->Label(-text => "This is before you press the button") ->pack(); my $button = $mainwindow->Button( -text => "press to change the label", -command => sub { $label->configure(-text => "This changed the label") } )->pack(); MainLoop();