I have the following Perl script that generates a string based on a number:
my @chars;
push @chars, map(chr, 48..57), map(chr, 97..122);
my $c = $#chars+1;
for (0..50) {
my $string;
my $l = $_ / $c;
my $i = int $l;
my $r = ($l - $i) * $c;
$string .= $chars[$r];
while ($i > 0) {
$l = $i / $c;
$i = int $l;
$r = ($l - $i) * $c;
$string .= $chars[$r];
}
print "$string\n";
}
When I run this I get the following output:
0
1
2
3
4
...
z
01
01
21
21
41
41
61
61
81
91
91
b1
b1
d1
d1
What am I missing? Thankful for any help!