in reply to Does print() write immediately to a file?
Run perldoc -q flush or read this: How do I flush/unbuffer an output filehandle? Why must I do this?.