Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

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:

67 42 99 28 15 14 92 12 45 57 16 41 99 67 28 15 57 12 45 14 92 12 92 42 67 28 15 45 57 16 12 99 14

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 by silentq
in thread sending a scalar to the interpreter as a command by silentq

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others about the Monastery: (8)
    As of 2014-11-23 22:47 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      My preferred Perl binaries come from:














      Results (134 votes), past polls