/usr/bin/perl use Tk; use threads; use strict; my $mw=MainWindow->new(-title=>'test'); my $button=$mw->Button( -text => 'show the problem', -command => sub{ print "button: ouch!\n"; my $thread=async{print "inside thread\n";}; print "before join\n"; $thread->join; } ); MainLoop;