programming-examples/perl/SystemFunction/A program that generates random integers between 1 and 10.pl
2019-11-15 12:59:38 +01:00

17 lines
374 B
Perl

#!/usr/local/bin/perl
# collect the random numbers
$count = 1;
while ($count <= 100) {
$randnum = int( rand(10) ) + 1;
$randtotal[$randnum] += 1;
$count++;
}
# print the total of each number
$count = 1;
print ("Total for each number:\n");
while ($count <= 10) {
print ("\tnumber $count: $randtotal[$count]\n");
$count++;
}