... @EXPORT = qw(Exists Ev exit MainLoop DoOneEvent tkinit); ... #### #!/usr/bin/env perl use strict; use warnings; use Tk; my $mw = MainWindow->new; $mw->Button(-text => 'Exit', -command => sub { exit })->pack; $mw->Button(-text => 'Destroy', -command => sub { $mw->destroy })->pack; MainLoop; print "After MainLoop\n"; #### $ pm_tk_exit_vs_destroy.pl # Using 'Exit' button $ pm_tk_exit_vs_destroy.pl # Using 'Destroy' button After MainLoop $