if($pid=fork){ while($c = ReadKey){ doing something... ; } } else { my $count = 0; while(1){ sleep(1); print $count++; } }