#!/usr/bin/perl use warnings; use strict; use Tk; my $mw = new MainWindow(); my $password = ''; my $entry = $mw->Entry( -show=>'*', -relief=>'ridge', -textvariable=>\$password )->pack; $entry->bind('',[\&somesub]); $entry->focus; # when the MainLoop is destroyed, the calling script can continue MainLoop; sub somesub { $password = $entry->get; print "password ->$password\n"; $mw->destroy; } print "you can continue on here\n"; <>; #wait for keypress to exit;