For pure perl Code, you may try :
if (-e "filename") { print "existed" }
else { open (FH, ">filename"); ...... ; close (FH)}

For temp files, you may try using time, plus
users IP, that would near 0% that you will 
have the risk to write to an existed file...

Hope this help, 
Smiley Connie =)

----- Original Message ----- 
From: "James Baster" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, July 02, 2002 11:46 PM
Subject: Opening files for writing that dont exist


> 
> Hi,
> 
> I want to open a temporary file somwhere and I am facing the problem of 
> making sure I dont write to an already existing temporary file, thus 
> curropting some other process somewhere else. Is there a way of telling 
> perl to open a new file for writing but to throw an error if the file 
> already exists?
> 
> Thanks,
> James.
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to