#!/usr/bin/perl use Tk; my $MainWindow = MainWindow->new; $MainWindow->title("Data Entry Form"); $MainWindow -> Label(-justify => 'left', -text => "Name of person : ") ->pack(-side => 'left',-anchor => 'n'); my $entry = $MainWindow -> Entry(-selectborderwidth => 10) ->pack(-side => 'top',-anchor => 'n'); $entry->bind('',[\&somesub]); $entry->focus; $MainWindow -> Button(-text => "OK", -command => \&somesub) ->pack(-side => 'bottom',-anchor => 'center'); MainLoop; #your script can continue here after Tk is done while(1){print time; sleep 1;} sub somesub { $,="\n"; $NameOfPerson = $entry -> get; print "\nNameOfPerson ->$NameOfPerson\n"; $MainWindow -> destroy; }