use Tk; my $mw = tkinit(-bg,'gray'); my $btn1 = $mw->Button(-text, "Hello There")->pack; my $btn1 = $mw->Button(-text, "Button 2")->pack; my $text = $mw->Text(-width, 40,-height, 5)->pack; my $super = ref $button; @kids = $mw->children; print @kids; foreach(@kids){ if(/Tk::Button/){ $_->configure(-bg, 'green'); } if(/Tk::Text/){ $_->configure(-bg, 'yellow'); } } MainLoop;