Are you adding $|=1 or $!=1 ? Setting $! is actually setting an error code. $|=1 is what was suggested--what that does (see perlvar man page) is set it to autoflush any output, so you're assured it goes to the screen immediately. otherwise, you could potentially have code like (i've had this happen in c way more than in perl) this, but you never see "hi":