use strict; use warnings; use Math::NumberBase; my $length = 4; my $b = Math::NumberBase->new($length); my $start = $b->to_decimal("1" x $length); my $end = $b->to_decimal("${\($length-1)}" x $length); print $b->from_decimal($_), "\n" for $start .. $end; __END__ 1111 1112 1113 1120 1121 1122 1123 1130 1131 1132 1133 1200 1201 ... 3310 3311 3312 3313 3320 3321 3322 3323 3330 3331 3332 3333