in reply to Unique filehandle -- what is correct?

Sorry, I didn't post my whole code:
$random_number = rand(); $tmpfile="TEMPFILE.random_number"; open OUT, ">$tmpfile"; print OUT $mydata; close OUT; # process the file..... ..... #end of processing unlink ($tmpfile);

Replies are listed 'Best First'.
Re^2: Unique filehandle -- what is correct?
by i5513 (Pilgrim) on Dec 11, 2011 at 12:34 UTC

    If you want to follow this way (I would recommend File::Temp like Perlbotics did), I would say you about using timestamp inside the name of temp file, for example:

    TEMPFILE.20111211133200.rand()

    Or even using microseconds precission

    But, definitively use File::Temp ;-)

    Regards,