use Tk; my_long_sub { print "You can't kill me!\n"; sleep 60; my_long_sub(); } $main = MainWindow->new; $main->Button( -text "Start Long Sub", -command \&my_long_sub)->pack; #### use Tk; $seconds = 60; not_a_long_sub { print "You can't kill me!\n"; #sleep 60; <-Replacing this with an after #my_long_sub(); <-After handles the call } $main = MainWindow->new; $main->Button( -text "Start Long Sub", -command \¬_a_long_sub)->pack; $main->after($seconds * 1000, \¬_a_long_sub);