use strict; use warnings; use Tk; my $enteredvalue; my $window = MainWindow->new(-title => 'myTitle'); my $entry = $window->Entry(-textvariable => \$enteredvalue)->pack; $entry->bind('', \&go ); $entry->focus; MainLoop; ### sub go { # Do your thing... }