#!/usr/bin/perl use strict; use warnings; use Tk; my $mw = Tk::MainWindow->new; $mw->minsize( 300, 250 ); my $entered = "\x{171}"; open OUT, '>>', $entered; binmode OUT, ":encoding(UTF-8)"; my $entry = $mw->Entry( -textvariable => \$entered, -width => 75, -takefocus => 1, )->pack(); $entry->focus( -force ); my $go = sub { print OUT "$entered\n"; }; my $buttgo = $mw->Button( -text => "Go", -command => $go )->pack(); $mw->bind( '', $go ); my $buttexit = $mw->Button( -text => "Exit", -command => sub { exit }, )->pack(); close OUT; Tk::MainLoop();