Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: "unique" filename?

by Fastolfe (Vicar)
on Dec 03, 2000 at 22:17 UTC ( [id://44687]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    $num = 12345;
    $dir = "/some/dir/";
    ...
    $num++ while -e "$dir/$num";
    
    open(F, ">$dir/$num") or die ...
    
  2. or download this
    use Fcntl;
    use FileHandle;
    ...
    $num++ while !sysopen(F, "$dir/$num", O_EXCL|O_CREAT, 0777) && $! eq "
    +File exists";
    
    die "$dir/$num: $!" if $!;
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2025-02-07 20:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which URL do you most often use to access this site?












    Results (95 votes). Check out past polls.