The var $! refers to the C library errno global variable. It is set in many places in the runtime system. errno is not explicitly reset by any library function.
You should only check $! if you know there is an error. (Such as after a failed open.) In fact, perlvar specifically states that it is meaningless if an error has not occurred.
In this case, you probably want $? which contains the error generated by the backticks operator.
In reply to Re: Using backquotes to echo results in "Bad file descriptor"
by gwadej
in thread Using backquotes to echo results in "Bad file descriptor"
by motionblurrr
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |