use strict;
use warnings;
use Tk;

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

$mw -> title('Test für pack');
$mw->geometry("100x50+100+100");

my $child;
my $text = "Create";
my $button = $mw->Button(-textvariable => \$text,
                         -command => \&doit)  ->pack();

MainLoop();

sub doit
  {
 	if($text eq "Create")
 	  {
 	  $child = $mw->Toplevel;
    $child->geometry("100x50+300+300");
    my $label = $child->Label(-text => "Hallo Universum!")
                ->pack();
 		$text = "Destroy";
 	  }
 	else
 	  {
 		$child->destroy();
 		$text = "Create";
 	  }
  }