Are you running this on a Win32 machine? I ran into the same problem too earlier on a Win32 machine. Ended up rewriting that section of code, so I'm not really sure why it started working the second time. Why doesn't perl run under the same user that calls it on Win32?