#!./perl
BEGIN { push(@INC, qw(../../../lib ../../lib ../lib lib)) }
use Tk;

$top = tkinit;

$foo = "Press to turn on";

# The text of this button tracks variable $foo
$b = Button::new($top, "-textvariable" => $foo, "-method" => \&switchit);

tkpack $b;
tkmainloop;

sub switchit {
    $foo =~ s/on/off/ or $foo =~ s/off/on/;
}
