#!/usr/bin/perl use strict; use warnings; use threads; use threads::shared; use Tk; my $xxx:shared=''; my $thread = threads->create( \&search_file ); $thread->detach; my $mw = tkinit(); $mw->Label( -text => 'hallo' )->pack; $mw->Entry( -textvariable => \$xxx )->pack; MainLoop; sub search_file { my $counter = 0; for (;;) { $counter++; $xxx = $counter; sleep 1; } }