...
People new to CGI programming often miss the fact that the http server will start multiple copies of your process, and any data files read/written could be done so at the same time. While reads are ok, all processes should be using
so they do not read partial data, or write at the same time as another process.