use strict; use warnings; use Tk; my ($mw,$EntryBox1,$EntryBox2,$variable1,$variable1_previous,$variable2); $mw = MainWindow->new; $EntryBox1 = $mw->Entry(-textvariable => \$variable1, ) ->place(-relx => 0.06, -rely => 0.03); $EntryBox2 = $mw->Entry(-textvariable => \$variable2, ) ->place(-relx => 0.06, -rely => 0.20); $EntryBox1->bind("",\&save_previous_value); $EntryBox1->bind("",\&compare_values); MainLoop; sub save_previous_value { $variable1_previous = $variable1; } sub compare_values { if ($variable1 ne $variable1_previous) { $mw->messageBox(-message => "The value has been changed.",-type => "ok"); } }