Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: sequencial file naming

by mbond (Beadle)
on Jun 08, 2001 at 21:14 UTC ( [id://86986]=note: print w/replies, xml ) Need Help??


in reply to sequencial file naming

We do this sort of thing a lot at work for surveys that need to be in text format so the various peopel that want to read them can.

However, we occassional delete files as well that were either tests, or smart-@$$ responces. So to keep track of the files that have been deleted i load the directory, knock off the "." and ".." files and iterate through looking for the first avialable slot.

foreach (@files) {
if ($_ == $last+1) {
open( ... );
}
$last = $_;
}


thats minus error checking, etc .. but its the jist of it.

just make sure you check for race conditions (as mentioned above), and iterate to the next one if needed.

Mbond.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2024-04-18 06:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found