in reply to Ulimit being reached

I think the error condition will normally not be detectable until you try to close() the file handle.

The return value from close() should be 0 and $! should indicate the error. The actual message will depend on the operating system.

-- FloydATC

Time flies when you don't know what you're doing