You could work with -textvariable (instead of -text) which binds a reference to a variable to the content of the entry, e.g
use vars qw($InputText);
$InputText = "";
my $input = $mw->Entry (-textvariable => \$InputText)->form;
# my $guess = int ($input->get);
my $guess = int( $InputText );
$InputText = ""; # empty it
Another Idea: If you just want to allow integer values to be entered, it often is a good way not to allow other input than numbers which makes errorchecking easier. Maybe Tk::NumEntry could be interesting for you, or my Tk::EntryCheck, e.g.
my $input = $mw->EntryCheck(
-textvariable => \$InputText,
-pattern => qr~\d~,
perl -e "s>>*F>e=>y)\*martinF)stronat)=>print,print v18.104.22.168.11.32"