my $id = $mw->repeat(10000, \&loop); MainLoop(); sub start { $textfield1->insert('end', "Eintrag"); } sub stop { $textfield1->delete(0); $textfield2->insert('end', "Eintrag geloescht"); } sub clear { $textfield1->selectionSet(0, 'end'); my @indexlist = $textfield1->curselection(); $textfield1->selectionClear(0, 'end'); # hier werden alle eintraege deselektiert foreach my $i ( @indexlist ) { $textfield1->delete(0); } } sub loop { $textfield1->selectionSet(0, 'end'); my @indexlist = $textfield1->curselection(); $textfield1->selectionClear(0, 'end'); # hier auch foreach my $i ( @indexlist ) { #do something } }