Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

RE: Creating a file in a CGI script...

by LeGo (Chaplain)
on Oct 04, 2000 at 08:38 UTC ( [id://35226]=note: print w/replies, xml ) Need Help??


in reply to Creating a file in a CGI script...

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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://35226]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2024-03-28 20:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found