in reply to Re^2: system function is returning status -1 when running a unix command
in thread system function is returning status -1 when running a unix command
print can result in system calls. $! is meaningless after the first print.
$ perl -wle' $SIG{CHLD}="IGNORE"; $! = 0; my $rv = system("ls -d ."); my $errno = $!; print $rv; print 0+$errno; print $errno; print 0+$errno; ' . -1 10 No child processes 10
Note that 0+ is much easier to understand than -+-, and it conveys the intent much better.
|
|---|