use strict;
use warnings;
use Tk;

# Das mw erzeugen
my $mw = MainWindow->new(-background => 'lightskyblue1');

$mw -> title('Test');

my $status = 0;
my $buttons = $mw->Frame();
my $label = $mw->Label(-relief => 'ridge',
                       -text => '0',
                       -textvariable => \$status);

foreach my $i (0..9) 
  {
  my $button = $buttons->Button(-text => $i, 
                                -command => [\&doit, $i]);
  $button->pack(-side => 'left',
                -fill => 'x', -expand => 1);
}

$buttons->pack(-side => 'top', -fill => 'x');
$label->pack(-pady => 5, -fill => 'x', -expand => 1);
MainLoop;

sub doit
  {
  $status = shift;
  }