$! only has meaning if the operation failed. After a success its value could be anything.
perldoc says: If used numerically, yields the current value of the C errno variable, or in other words, if a system or library call fails, it sets this variable. This means that the value of $! is meaningful only immediately after a failure:
In reply to Re^2: Socket descriptor passed across fork -- hanging
by SuicideJunkie
in thread Socket descriptor passed across fork -- hanging
by dd-b
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |