#! /usr/bin/perl use warnings; use strict; use Tk (); use Tk::EntryCheck; my $mw = MainWindow->new(); my $var = 'VAR'; $mw->EntryCheck(-maxlength => 5, -pattern => qr([A-Za-z0-9]), -textvariable => \$var)    ->pack(-side => 'left'); $mw->Button(-text => 'Pushme',    -command => sub { $var = '.d'; })    ->pack(-side => 'left'); &Tk::MainLoop;