#!/usr/bin/winperl use warnings; use strict; use Tk; my $mw = MainWindow->new(); $mw->Label(-text => 'Do it')->grid(); my $btn; $btn = $mw->Button( -text => 'Click me', -command => sub { $btn->gridForget() }, )->grid(); MainLoop;