Cast your random floating-point number as an int.
Input:
my $range = 10;
# create random integer as low as 0 and as high as 9
my $random = int(rand($range)); # max value is up to but not equal to $range
print $random . "\n";
Output:
A random integer, like...
0
See also the perldoc for rand.