I just finished doing a cgi script (well a part of it). I realized that you might want to make sure the file exist or doesn't exist. Depending on whether or not you want it to. I did not want the file to exist so I did this.
my $file = "data2.dat";
if (-e $file){
$file = "data3.dat";
open (FILE, ">$file") or die "Can't open the file $!\n";}
else {
open (FILE, ">>$file") or die "Can't open the file $!\n";}
Basically if the file exist I wanted to create another file. This was so I did not erase anything.
LeGo