Single-Line Text Entry
#!/usr/bin/perl -w use Tk; $main = MainWindow->new(); $label = $main->Label(-text=>"Enter user name:"); $label->pack(-side=>"left"); $entry = $main->Entry(); $entry->bind("<Return>", \&handle_return ); $entry->pack(-side=>"left"); MainLoop(); sub handle_return { $txt = $entry->get(); print "You entered $txt\n"; exit; }