#!/Perl/bin/perl use strict; use warnings; use threads; use threads::shared; my $runs : shared = 0; my $thr1 = threads->new(\&startGui, \$runs); my $thr2 = threads->new(\&startRequest, \$runs); $thr1->join(); $thr2->join(); sub startGui { require Tk; my $mw = Tk::MainWindow->new(); $mw->packPropagate(0); $mw->Label(-textvariable => \$runs)->pack(); $mw->MainLoop(); } # /startGui sub startRequest { while(1) { $runs++; print "run $runs\n"; sleep(1); } } # /startRequest