Leser: 1
|< 1 2 >| | 12 Einträge, 2 Seiten |
1
2
3
4
5
6
7
8
9
10
11
12
13
@args = ("command", "arg1", "arg2");
system(@args);
if ($? == -1) {
print "failed to execute: $!\n";
}
elsif ($? & 127) {
printf "child died with signal %d, %s coredump\n",
($? & 127), ($? & 128) ? 'with' : 'without';
}
else {
printf "child exited with value %d\n", $? >> 8;
}
Quote$? The status returned by the last pipe close, backtick (``) com-
mand, successful call to wait() or waitpid(), or from the sys-
tem() operator. This is just the 16-bit status word returned
by the wait() system call (or else is made up to look like it).
Thus, the exit value of the subprocess is really ("$? >> 8"),
and "$? & 127" gives which signal, if any, the process died
from, and "$? & 128" reports whether there was a core dump.
(Mnemonic: similar to sh and ksh.)
Quote... ist eine Zahl die nur 1 Byte gross ist bzw. geht ja von -128 bis ca. 128 (positiv) oder alternativ kann man zahlen von 0 bis 255 darstellen.
|< 1 2 >| | 12 Einträge, 2 Seiten |