in reply to writing to a file in a cgi script

My guess is that the path to file is wrong.

You can check this using the Cwd module.

#!/usr/bin/perl use strict; use CGI; my $q = new CGI; use Cwd; $dir = cwd; print $q->header('text/plain'), $dir; exit(0);

My bet is that the current working directory isn't what you think it is when run as a CGI script.

Alternatively, use an absolute path rather than a relative one, ie:

open OUT, ">/path/to/bg.cnt" or die "can't open bg.cnt for writing";

.02

cLive ;-)

ps - and including $! in the die statment will help - if you put:

use CGI::Carp 'fatalsToBrowser'
at the beginning of your script.