The problem now is I am using timestamp in seconds and there could be more than one name generated in the same second with same user provided name.
How about using a simple incrementing number in this case? You can use sysopen to do this and avoid race conditions:
use Fcntl; my $username = "..."; my $filename = $username . time; my $inc = 1; my $fh; until (sysopen $fh, $filename.$inc, O_WRONLY|O_CREAT|O_EXCL) { $inc++; } print $fh time, "\n";
In reply to Re^3: Time in Milliseconds or NanoSeconds
by revdiablo
in thread Time in Milliseconds or NanoSeconds
by ramya2005
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |