How can I create a random number between two numbers in Perl
问题 I've seen many other ways to do this in other programming languages... Though I havent found one in Perl yet... What I want to accomplish is to set two numbers: $minimum = 100; $maximum = 4000; Then to create a random integer between those two. (whole number) ($random_num) I've looked into this site: http://perlmeme.org/howtos/perlfunc/rand_function.html Which is a good resource, although does not do exactly that. 回答1: my $x = $minimum + int(rand($maximum - $minimum)); http://perldoc.perl.org