#!/usr/bin/perl use warnings; use strict; use Tk; my $mw = MainWindow -> new; my $m = $mw -> Message (-text => "testing, one, two, three...") -> pack; $mw->Button(-text => 'Go', -command => \&fire)->pack; MainLoop(); sub fire { for my $n (1 .. 10) { print "$n\n"; sleep 1; } $m -> destroy; print "Done\n"; }