[Omaha.pm] need 315k alpha-numeric numbers with a width of 6?
Sean Baker
pbaker at omnihotels.com
Fri Feb 13 09:12:46 PST 2009
I just had a request to generate 315k alpha-numeric numbers with a width
of 6.
Base 36 comes in handy!
#!/usr/bin/perl
use strict;
use Math::Base36 ':all';
my $number = "60466176"; # = 100000 in base 36, width of 6
my $ctr=1;
while ($ctr < 315001) {
my $b36 = encode_base36($number);
$number+=15;
print "$b36\n";
$ctr++;
}
Wallah! I'm adding 15 to each number because I need a gap.
Sean
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/omaha-pm/attachments/20090213/f5dc1008/attachment.html>
More information about the Omaha-pm
mailing list