#!/usr/Bin/perl -w use strict; use warnings; use Threads; my $thread = threads->create( \&test ); $thread->detach; use Tk; # Create the window my $main = new MainWindow; my $label2 = $main->Label( -pady => '1', -relief => 'flat', -padx => '1', -state => 'normal', -justify => 'center', -font => [-family => 'Arial',-size => 14, -weight => 'bold',], -text => 'Status', )->place( -x => 125, -y => 25); MainLoop; sub test{ my @thrs; for (1..10){ #print "$_\n"; push @thrs, threads->create(\&inside, $_); } $_ -> join for @thrs; print "done2\n"; } sub inside{ my $i = shift; my $j = rand(10); #print "Thread $i..... $j\n"; sleep($j); #print "Thread $i ready\n"; }