use threads; use threads::shared; my $test :shared; $test = 0; testing_thread(); sub testing_thread { my $thr1 = threads->create(\&progress_count, $test); while ($test <= 1000000) { $test += 1; } $thr1->join(); } sub progress_count { while( $test < 1000000 ) { print $test, " \n"; } }