#!/usr/bin/perl -w use strict; use Tk; my $test = 123; my $mw = tkinit(); my $l1 = $mw->Label(-text => $test)->pack(); $mw->Button(-command => sub {chg_txt(\$test)} )->pack; MainLoop; sub chg_txt { my $test = shift; $$test = 'Testtext2'; $mw->update(); }