If the aim is to create a temporary file name (quite slow method):
use Time::HiRes qw(gettimeofday);
my $rand = \&gettimeofday;
my $temp_file_name = sub{ int(rand($rand->())) };
$temp_file_name = sub{
local $.;
$..= $temp_file_name->()
for 1..5;
return $.;
}->();