#!/usr/bin/perl use strict; use warnings; use threads; use Tk; my $thread = threads->create( \&search_file ); $thread->detach; my $mw = tkinit(); $mw->Label( -text => 'hallo' )->pack; MainLoop; sub search_file { for my $counter ( 1 .. 10 ) { print $counter,"\n"; sleep 1; } }