$stopped = 1; my $stop = sub { $stopped = 1 if shift() }; ... $game->command( -label => '~Stop', -command => $stop, -accelerator => 's' );