in reply to Generating combinatorial strings
00000 00001 00002 00010 ... 22222 [download]
Take a look at Math::BaseArith