Code is stupid...but people get mad if you dont try before asking for help. I get 18 rands to scratch.dat most of the time. However, some of the time, the hourglass comes up and I get only 12 results. Your ideas?
I appreciate it.
----
$seen = 0;
$reps = 1;
while ($reps < 19)
{
$random_number = int(rand(336)) +1;
if (-e "scratch.dat")
{
open (SCR, "scratch.dat") || &CgiDie ("SCRATCH could not be opened while attempting read");
@scra =<SCR>;
close (SCR);
foreach $mine (@scra)
{
chomp($mine);
($junk, $num_to_check) = split (/\|/, $mine);
if ($num_to_check == $random_number)
{
$seen = 1;
}
}#end of foreach line
}#end of if scratch data exists
if ($seen == 0)
{
open (SCR, ">>scratch.dat") || &CgiDie ("SCRATCH could not be opened while attempting write");
seek(SCR, 0, SEEK_END);
print SCR "junk\|$random_number\n";
close(SCR);
$seen = 0;
$reps++;
}
}# End of lets do 18 reps...
#unlink ("scratch.dat");
&printout;
}
else
{
&signin;
}