Hey, I'm trying to generate random strings with numbers from 1-100. I have the following code:
Which works fine, but I'd like to have something separating the different numbers. For examples rather then having eight, eleven, three be 8113 print as 8,11,3 or 8 11 3, or something similar.
Thanks.
Code:
sub generate_random_string
{
my $length_of_randomstring=10;
my @chars=('1'..'100');
my $random_string;
foreach (1..$length_of_randomstring)
{
$random_string.=$chars [rand @chars];
}
return $random_string;
}
my $random_string=&generate_random_string(11);
print " .$random_string."\n";
Which works fine, but I'd like to have something separating the different numbers. For examples rather then having eight, eleven, three be 8113 print as 8,11,3 or 8 11 3, or something similar.
Thanks.
Last edited: