in reply to Non-blocking pipe write

I'm not sure how it will work for what you are doing, but I've had to use

$| = 1;

to force the buffer to flush to a pipe after each iteration. I don't know if this will help in your specific case (I code admin scripts on HPUX, Solaris and Linux; not Win), but I thought I'd offer it.