use warnings; use strict; use Tk; my $num = 0; my $mw = tkinit(); my $button = $mw->Button(-text => $num)->pack(); $button->bind('', \&buttonPressed); $mw->MainLoop(); sub buttonPressed{ #this subroutine should be executed if the button is clicked once, #or repeatedly executed if the button is held down. print "."; $button->configure(-text => $num++); }