#!/usr/local/bin/perl use warnings; use strict; use Tk; # Global variables my $entry_val; # Main Window my $mw = new MainWindow; $mw->Entry( -validate=>"all", -validatecommand=>\&handleEvent, -textvariable=>\$entry_val, )->pack(); MainLoop; # Callbacks sub handleEvent { my ($new_val, $chars_2_change, $curr_val, $index, $action) = @_; # do nothing if No Change and No Force Validate if (!$chars_2_change && $action != -1){ return; } # do something meaningful here. # for now, just print the $new_val print $new_val."\n"; }