use strict; use warnings; use Tk; my ($mw,$EntryBox1,$EntryBox2,$variable1,$variable2,$entry,$variable_previous,$variable_current); $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); $mw->bind("Tk::Entry","",\&save_previous_value); $mw->bind("Tk::Entry","",\&compare_values); MainLoop; sub save_previous_value { $entry = shift; print "$entry\n"; # i was hoping this would print '$EntryBox1' or '$EntryBox2' # instead it gives me 'Tk::Entry=HASH(0x1bf2f7c)' # or 'Tk::Entry=HASH(0x1bfa9a4)' $variable_previous = $entry->get(); } sub compare_values { $entry = shift; $variable_current = $entry->get(); if ($variable_current ne $variable_previous) { $mw->messageBox(-message => "The value has been changed.",-type => "ok"); } }