my $var = 'X'; foo(\$var); print $var; sub foo { my $out = shift; # .. my $campus_but = $campus_frame -> Button(-text=>"HAW_Campus", -command => sub {$mw->destroy(); $$out = 'A'; }) -> pack(); # ... }