I have a subroutine &newID that constructs a pseudo-random ID on every 
invocation. Regularly, a file needs to be created in a directory, say 
$ARTIKEL_DIR, using a newly generated ID. Of course, I want to make sure 
that the file (the ID) doesn't exist yet. Of course, I could put all IDs 
previously generated in a kind of logfile and check that logfile. But 
then I thought of this:

do {
   $artikelID = &newID;
} until (!`$ARTIKEL_DIR.$artikelID`); 

open ($artikelID);

Would that work at all? What I think it should do is: 'Create a fresh 
pseudo-random ID, check if a file with that name exists in the directory 
specified, if it does, try again, if not, open the (new) file.

Can I do this using the `filename` construction? Could this work? Are 
there any security / performance issues?

-- 
martijn van exel -+- [EMAIL PROTECTED] -+- http://huizen.dds.nl/~mvexel/

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

Reply via email to