in reply to How to catch that pid?

My problem: I realized open3 returns the pid only at closure.

If "at closure" means when the child exits, that's wrong. open3 returns the childs pid, and open3 returns as soon as the child is launched.

use feature qw( say ); use IPC::Open3 qw( open3 ); open(local *TO_CHLD, '<', '/dev/null') or die $!; my $pid = open3( '<TO_CHLD', local *FR_CHLD, '>STDERR', 'perl', '-E', 'sleep 2; say $$;' ); say time, ": ", $pid; while (<FR_CHLD>) { print time, ": Perl said: $_"; } waitpid($pid, 0);
1327100100: 27601 1327100102: Perl said: 27601