use Tk; use Tk::Table; use strict; ##Variablen: my @ressorts = sort ("Wurst      ", "Brot       ", "Getränke   ", "Bio        ", "Kleidung   ", "Sonstiges  ", "Bus & Bahn "); my @DATE_DAYS_NAME = qw(Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Samstag); my (@widgets_label, %widgets_button); ##Hauptfenster: my $mw = MainWindow-> new (-title => "Testbeispiel"); ##Tabelle: my $table_woche = $mw-> Table (-columns => 8, -rows => 8, -relief  => 'raised', -scrollbars => 0); foreach my $index (0..6) {    $widgets_label[$index] = $mw-> Label (-text => $DATE_DAYS_NAME[$index], -font => "Arial 11 bold underline");    $table_woche-> put (1,$index+1, $widgets_label[$index]);    $widgets_label[$index] = $mw-> Label (-text => $ressorts[$index], -font => "Courier 11 bold", -justify => 'left');    $table_woche-> put ($index+2,0, $widgets_label[$index]);        #Buttons mit den Ausgaben    foreach my $zeile (0..6) {        $widgets_button{"$DATE_DAYS_NAME[$index]_$ressorts[$zeile]"} = $table_woche-> Button (-textvariable => \$ressorts[$zeile], -width => 10, -relief => 'sunken', -justify => 'left', -command => sub {print "$ressorts[$zeile], $DATE_DAYS_NAME[$index]\n";});        $widgets_button{"$DATE_DAYS_NAME[$index]_$ressorts[$zeile]"}-> configure (-activebackground => 'blue');        $table_woche-> put ($zeile+2,$index+1, $widgets_button{"$DATE_DAYS_NAME[$index]_$ressorts[$zeile]"});        } } $table_woche->pack (-side => 'left'); MainLoop;