in reply to Perl Tk-How to return from 'MainLoop'

Destroy the main window:

use strict; use warnings; use Tk; my $mw = MainWindow->new; $mw->Button (-text => "Hello World!", -command => sub {$mw->destroy()} +)->pack; MainLoop; print "done with the GUI\n";

Prints:

done with the GUI

DWIM is Perl's answer to Gödel