#!/usr/bin/perl -w use strict; use Tk; my $Main = MainWindow->new(); my $text = "foobar"; my $Entry = $Main-> Entry( -textvariable => \$text )-> pack( -expand => 1, -fill => 'x' ); my $Button = $Main-> Button( -text => 'Clear', -width => 20, #choose one of the following #-command => sub { $text = '' } #-command => sub { $Entry->delete( 0, 'end' ) } )->pack(); MainLoop;