A couple of basic debugging tests need to be applied here:
- Have you proven that you're getting to the 2nd open statement?
- Have you proven you're actually spending time in the loop?
It seems to me that it the program 'proggie.exe' never exits, then if open() uses a system() call internally, and not a fork(), it's waiting for the program to finish before the output will be passed back to the calling process (i.e. your script).
In a *nix land, this might work, I don't know for sure. But in a Windows environment, I think you're going to have problems.
I would recommend turning off buffering ($| = 1) and putting some judicious print statements to make sure you're getting as far as you think you are.
--Chris
e-mail jcwren