in reply to Bad file descriptor error when tried to run script using do

This is a guess, but it seems very likely to be relevant: Don't print out the value of $! except very soon after a function has failed (and then only for functions that are documented to set $! on failure). You should not examine $! to try to determine if something failed. The function tells you that it failed (usually by returning a false value) and only after that you record $! to get a better idea as to why it failed. $! frequently gets set by mundane operations under the covers. Almost no functions reset $! if nothing failed.

Next time, you might want to actually paste even a couple of lines of the actual code that you are having a problem with. Less guessing often means faster relevant answers.

- tye        

  • Comment on Re: Bad file descriptor error when tried to run script using do ($!)