Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Here's a clever, yet impractical, solution. It combines the eye-popping memory growth of tye's first solution, with the incomprensibility of string building. Anyway, glob() can do this pretty handily, the problem is you need to build the string it uses first: $glob_string ends up looking like (split into two lines for better wrapping): {,0,1,2,3,4,5,6,7,8,9}{,0,1,2,3,4,5,6,7,8,9}{0,1,2,3,4,5,6,7,8,9} {0,1,2,3,4,5,6,7,8,9}{0,1,2,3,4,5,6,7,8,9}{0,1,2,3,4,5,6,7,8,9}which glob uses to do the work. I'll note that I was surprised by the memory consumption because in scalar context, glob is a simple iterator. But I suppose it builds all the matches up first and then iterates through them, instead of building them as it goes. In reply to Re: Generate sequential array element combos
by kelan
|
|