Tk is an event-driven GUI toolkit, and provides numerous ways to hook into the event loop. You might want to use the after method (documented in the Tk::after man page). Example:
#!/usr/bin/perl
use Tk;
$timeout = 8000;
$m = tkinit;
# prevent pack() sizing the Toplevel down so
# that we can still reach the controls
$m->packPropagate(0);
$m->Label(
-text =>'hi',
)->pack;
$m->Button(
-text=>'Ok',
-command => sub {
$m->destroy;
},
)->pack;
# invoke a callback after $timeout msecs
$after = $m->after(
$timeout,
[$m, 'destroy'],
);
MainLoop;
conv