In
die print "zero";
die
will use the return value of print "zero";
, which is 1
, as its argument. So you see the 1 at ...
message.
By default, the STDOUT
of interactive program is line buffered, but STDERR
is unbuffered, that is why you see the 1 at ...
(on stderr) first, and zero
(on stdout) later. If you change that print "zero"
to print "zero\n"
, you will see zero
comes first.