I don't see the point of initialising $!.
Functions are free to change $! even if no error occurred, and do so. Whatever value you set won't stay there.
$ echo foo | perl -le'$!=1; print 0+$!; <>; print 0+$!' 1 9
$! is meaningless unless a function notified you that it set $!. You can't read $! and compare it against the value you previously gave it. You would think the readline in the above example had failed.
die will use $! if it's non-zero, but it will fall back to $?>>8 then to 255. If anything, that means $!=0; would be the best value with which to initialise $!.
In reply to Re^2: system command - OK on 32 bit, fails on 64 bit Linux - why?
by ikegami
in thread system command - OK on 32 bit, fails on 64 bit Linux - why?
by geep999
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |