$win->Button(-text => 'OK', -command => [\&ok, $win])->pack; #### sub ok { my $win = shift; $win->destroy; $notified = 1; }