I have perl script which appends a new line to the existing file every 3 seconds, also there is a C++ application which reads from that file. The problem is that the application begins to read the file after the script is done and file handle is closed. To avoid this I want to flush after each line append, but I'm new in perl and don't know how to do that.
Why don't you try:
use IO::Handle; $fh->autoflush;
This was actually posted as a way of auto-flushing in an early question of mine, which asked about the universally accepted bad way of achieving this :-)