Do you have a $SIG{__DIE__} handler that calls exit?
They write a formatted log line and close the log file.
Both of which can change $!. It's unrelated to the problem you asked about, but a bug nonetheless.
In reply to Re^5: bad die behaviour?
by ikegami
in thread bad die behaviour?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |