for(my $i = 0; $i < 100; $i++) { $pm->start and next; (tied $testvr)->shlock; if($testvr >= 5) { $testvr = 0; } $testvr++; (tied $testvr)->shunlock; (tied $testvr)->shlock; print $testvr . "\n"; tied $testvr)->shunlock; $pm->finish; } $pm->wait_all_children;