in reply to Perl Forking : perform some action until child process dies

The issue you are encountering is that waitpid ($pid,0) is a blocking call. This means that the conditional on your until loop doesn't finish executing until your child has actually returned. You can perform a non-blocking call on systems that support it using:
use POSIX ":sys_wait_h"; #... do { $kid = waitpid(-1, WNOHANG); } while $kid > 0;
where the above is copied from waitpid. Note that not all systems support non-blocking calls to waitpid. See also perlipc.

Replies are listed 'Best First'.
Re^2: Perl Forking : perform some action until child process dies
by robrt (Novice) on Sep 03, 2010 at 04:48 UTC

    Many thanx... this worked

    But I used "while $kid = = 0; " instead.. which means.. while the child process is still running.. keep calculating the bandwidth in the do { }