#!/usr/bin/env perl use strict; use warnings; use Tk; my $mw = MainWindow->new; $mw->Button(-text => 'Problem: exit', -command => sub { exit } )->pack; $mw->Button(-text => 'Solution: destroy', -command => sub { $mw->destroy } )->pack; MainLoop; print "After MainLoop\n";