in reply to Writing to a file which is external to cgi-bin directory

The problem is that you didn't include the two magic lines:
use strict; use warnings;
If you had you would have seen these indications that Something Was Not Right(tm):
Bear> perl open.txt flock() on unopened filehandle OUT at open.txt line 9. seek() on unopened filehandle OUT at open.txt line 10. print() on unopened filehandle OUT at open.txt line 11.

----
I Go Back to Sleep, Now.

OGB