use strict; use warnings; use Tk; my $widgets = {}; $widgets->{main} = MainWindow->new; $widgets->{button} = $widgets->{main}->Button( -text => "Whatever you do - don't push me", -command => [ \&callme, $widgets ] )->pack; MainLoop; sub callme { my $w = shift; $w->{main}->configure(-title => 'How dare you push me!'); # Anything else in the $widgets hash is available here # too - handy if you have lots of widgets you need to # control from your functions or methods. }