#!/usr/bin/perl use strict; use Tk; my $mw = MainWindow->new; my $but; # declare before so you can use it in the callback $but = $mw->Button(-text => "Hello World", ## This callback works (text is changed) under Win95, Win98 (5.6.1) # # -command => [sub { my $b = $_[0], #notice comma # $b->configure(-text => "Hello Stranger"); # }, $b]); #This callback works under Win95, Win98 (5.6.1) and Linux (5.6.0) -command=>[\&change, $but]); $but->pack; MainLoop; sub change { my $but = $_[0], #notice comma $but->configure(-text=>"Hello Stranger", -bg => 'pink'); }