#!/usr/bin/perl use strict; use Tk; my $mw = MainWindow->new; my $b = $mw->Button(-text => "Hello World", -command=>[\&change])->pack(); my $l = $mw->Label(-text => 'hi')->pack(); MainLoop; sub change { $b->configure(-text=>"Hello Stranger"); $l->configure(-text=>'bye'); }