#!/usr/bin/perl use warnings; use strict; use Tk; my $mw = new MainWindow; my $ent = $mw -> Entry( -bg => 'white', ) -> pack(); $ent->focus; # so cursor is there in the entry $ent->bind('', \&process_it ); my $button = $mw->Button(-text => 'Submit', -command => \&process_it )->pack(); MainLoop; sub process_it { my $var = $ent->get(); print "$var submitted\n" }