|Perl: the Markov chain saw|
Thanks for your quick response, David. I really appreciate it.
I would actually prefer to solve the problem without resorting to eval just as you have recommended. But, for some reason, I just can't quite wrap my head around how to do it. Maybe you or someone else can help.
What I have is a two-dimensional array filled with scores. That looks something like this:
The array can be varying widths and heights. In other words, there are variable numbers of rows and columns.
What I want to do is find all the possible combinations when taking one item from each row. I believe there are x^y possible combinations where x represents the number of rows and y represents the number of columns. What I want is this: 67-41-92, 67-41-42, 67-41-67, 67-41-28 ...
I believe it's just a matter of nesting arrays. The trick is setting up a dynamic number of these. I played around with the idea of using a while loop, but the problem is that this resulted in consecutive iterations through the arrays, not nested iterations.
So I'm really at a loss at this point. If anyone can help, I'd be very grateful.Thanks,
In reply to Re^2: sending a scalar to the interpreter as a command