in reply to flushing by default

You could use unbuffered IO by using syswrite instead of print but don't use both. syswrite is also available as part of IO::Handle.