#! /usr/bin/perl -w use strict; eval { require Tk; import Tk; }; die "Can't load Tk" if $@; MainWindow->new->Button(-text => "Cancel", -command => sub {exit 1} )->pack(-side => 'left', -expand => 1); Tk::MainLoop(); #### #! /usr/bin/perl -w use strict; use Tk; MainWindow->new->Button(-text => "Cancel", -command => sub {exit 1} )->pack(-side => 'left', -expand => 1); Tk::MainLoop(); #### Callback called exit. Callback called exit.