[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Omaha.pm] need 315k alpha-numeric numbers with a width of 6?



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