#!/usr/bin/perl -w use strict; use Tk; my $mw = tkinit(-title => 'Test'); my ($top,$label); my $btn = $mw->Button(-text => 'Topelevel oeffnen', -command => sub { $top=$mw->Toplevel; $label = $top->Label(-text => 'Ich bin ein Toplevel')->pack; kill_toplevel($top); })->pack; MainLoop; sub kill_toplevel { my $top = shift; $top->after(100*10, sub {$top->destroy}) }