Yes - I did use the $! afterwards - sorry that wasn't in the code there. That's how I found out it was a "Bad File Descriptor" error message. Until then I didn't have anything. I saw the "|-" usage when I was looking into this problem too - maybe I'll change it to that. Any thoughts about the cause of the error message?
"Bad file descriptor" doesn't make sense as a failure reason for the code you posted. So I suspect your problem is something else. Please cut and paste some exact code that demonstrates the problem and the exact output that it produces.
I agree the code itself looks OK. It works fine on other clients servers. That's why I mentioned about NT 2003 ... I thought there might be something different about that server type with permissions, etc.
I will try the $^E to see what I get. It might be a couple of days before I get access to that server again.