in reply to Re^3: Generate sequential array element combos
in thread Generate sequential array element combos
For that case you can get as simple as
for( map '0'x$_ .. '9'x$_, 4..6 ) {
but that chews up quite a chunk of memory. You can use tons less memory with something like
for my $len ( 4 .. 6 ) { my $pat = '0' x $len; while( $len == length $pat ) { # ... $pat++; } }
But, of course, that won't help much if you hope to change your list of characters to something other than 0..9.
Algorithm::Loops would probably be quite helpful for this if you do hope to use characters other than digits. But I think I'll not code an example for that at this point, though it can be done fairly simply (or more complexly if you want a single iterator, for example).
- tye
|
|---|