#!/usr/bin/perl use warnings; use strict; use Tk; my $mw = new MainWindow; my $ent = $mw -> Entry() -> pack(); $ent->focus; $ent->bind('', \&clear ); $ent->bind('', \&clear ); MainLoop; sub clear { $ent->delete(0,'end'); }