in reply to Re: system and $?
in thread system and $?

you get -1 in case of any kind of execution error.

Not on Windows 2000, as you can see from my example. I don't know about XP or Vista. Maybe someone could try this out?

BTW, to get the return code on Windows 2000 (ActiveState Perl again - I don't know about Strawberry), you need to do a bit more logic than you posted, because you can't distinguish between a program execution error, and a program which runs fine but returns exit code 1. Here is what you have to do:

$!=0; system('your_program_goes_here'); my $child_error=$? & 0xff; my $maybe_exit_code=$? >> 8; if($child_error || ($maybe_exit_code && $!)) { # there was an error in program execution }
Also note that even if $?==0, it does not say that your program terminated with exit code 0. You get only the low 8 bit of the "real" Windows exit code, so if your program exited with a code which is a whole multiple of 256, you wouldn't notice it.
-- 
Ronald Fischer <ynnor@mm.st>