Pass an upper limit as an argument to the rand() function.
Input:
my $upper_limit = 100; my $random = rand($upper_limit); print $random . "\n";
Output:
A random floating-point number, like...
45.8733038119139