Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
I am stuck with this complicated problem. I have a list

** LIST**

substrate[s]: 3649 product[s]: 3419 3648 substrate[s]: 3645 product[s]: 3647 substrate[s]: 3659 product[s]: 3647 substrate[s]: 3675 product[s]: 3674 substrate[s]: 3674 product[s]: 3490 3489 substrate[s]: 3489 product[s]: 3490 substrate[s]: 3490 product[s]: 3485 substrate[s]: 3485 product[s]: 3486 substrate[s]: 3486 product[s]: 3488 substrate[s]: 3488 product[s]: 3487 substrate[s]: 3487 product[s]: 3877 substrate[s]: 3877 product[s]: 3419 substrate[s]: 3182 product[s]: 1875 substrate[s]: 2809 product[s]: 3182 substrate[s]: 3186 product[s]: 2809
Now I have a superlist each of substrate & product as:-


substrate[s]: 3649 substrate[s]: 3645 substrate[s]: 3659 substrate[s]: 3675 substrate[s]: 3674 substrate[s]: 3489 substrate[s]: 3490 substrate[s]: 3485 substrate[s]: 3486 substrate[s]: 3488 substrate[s]: 3487 substrate[s]: 3877 substrate[s]: 3182 substrate[s]: 2809 substrate[s]: 3186 substrate[s]: 3675 substrate[s]: 3492 substrate[s]: 3314 substrate[s]: 3006 substrate[s]: 3049


product[s]: 3419 product[s]: 3648 product[s]: 3489 product[s]: 3647 product[s]: 3647 product[s]: 3674 product[s]: 3490 product[s]: 3490 product[s]: 3485 product[s]: 3486 product[s]: 3488 product[s]: 3487 product[s]: 3877 product[s]: 3419 product[s]: 1875 product[s]: 3182 product[s]: 2809 product[s]: 3492 product[s]: 3186 product[s]: 3492 product[s]: 1825 product[s]: 2543
The superlist_product and superlist_substrate will encompass all the possible substrates & products in LIST. ie. substrate(LIST) is a subset of superlist_substrate and similarly for product(LIST). Now i want to create a SUPERARRAY as superlist_substrate(rows) X superlist_product(columns). Now parse the LIST for each substrate id one by one insert a "1" for each product id in the SUPERARRAY. For example consider first two lines of LIST

substrates: 3649

products: 3419 3648

So for substrate id 3649 ,the row id=3649 will be selected from SUPERARRAY and a "1" will be inserted at column ids 3419 & 3648 of the SUPERARRAY. And so on for the entire LIST.Basically SUPERARRAY will be a matrix.

In reply to A file parsing and 2D array/matrix problem. by zing

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!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • 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
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            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?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others making s'mores by the fire in the courtyard of the Monastery: (3)
    As of 2018-03-18 04:18 GMT
    Find Nodes?
      Voting Booth?
      When I think of a mole I think of:

      Results (228 votes). Check out past polls.