in reply to Forking and writing to files

I'd strongly recommend using "threads" and Thread::Queue.

This provides a clean OO interface and simplifies your programming, reduces debugging and maintainance headaches.

Basically, you would start off a FileOutput thread, that reads the queue, and outputs to the file. Other worker threads write into the queue. They have no knowledge of the file. Very simple, clean interface.

Offense, like beauty, is in the eye of the beholder, and a fantasy.
By guaranteeing freedom of expression, the First Amendment also guarntees offense.