in reply to Re: Reading return value from C program
in thread Reading return value from C program

fork sets $!, not $?.

Replies are listed 'Best First'.
Re^3: Reading return value from C program
by Anno (Deacon) on Mar 15, 2007 at 18:20 UTC
    agianni's code wouldn't make sense after a fork(), that's true. It would make sense after a waitpid. Maybe that was the tacit assumption. It would have been better made explicit.

    Anno

      Even after waitpid, $? doesn't indicate whether the child was launched successfully or not. $? indicates whether the child *ended* successfully.

        Sorry for the lack of clarity, do the updated comments better reflect the meaning of $?