Seeking Perl Knowledge

Chris Midkiff cmidkiff at kc.rr.com
Tue Mar 7 01:47:25 CST 2000


Hi all...

Are there any Perl hackers out there?  This may be a little off topic, but I thought I'd check here 
first.  I am (trying) to learn Perl, and have run into a problem that I don't know a good way to 
get around...

I need a random, integer value that I can test against.  This is for a "Guess the Number" type of 
game (hey, you gotta start somewhere...)  Anyway, I got the random number generator working, but it 
returns a value extended to 14 decimal places.  Is 
there an equivelent to int($num) somewhere that I'm missing?  I have a real ugly solution, but 
there has to be a better way.

ugly code snip**

$num = rand($level * 10);
$count = 0;
while($count < $num){$count++}
$num = $count

Thanks for any assistance ...  
If I can get the thing looking a little better, I'll post the source for anyone who is interested...

Chris Midkiff
cmidkiff at kc.rr.com




More information about the Kclug mailing list