in reply to writing to a log file....

Or possibly this is a buffering issue.

The data gets written to the actual file only if a certain amount of it is accumulated in the buffer. (Or something to that effect.)

Try select LOG; $|++; before the first </code>print LOG</code> statement or simply $|++; at the beginning of your file.