Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Hi guys. I have finally managed to assemble this code with some help.
my %supermatrix; my $list = "LIST.txt"; open my $DATA, '<', $list or die "unable to open my list $list $!\n"; print "\nWORKING ON $list\n"; print `head $list`; while (my $line = <$DATA>) { chomp $line; my $substrate = 1 if $line =~ /substrate.*(\d+)$/; print "SUBSTRATE ===$substrate"; $line = <DATA>; # fetch next line print "PRODUCT====$line"; my @products; (undef, @products) = split / /, $line; foreach my $prod (@products) { $supermatrix{$substrate}{$prod} = 1; print "combination $substrate $prod exists ! \n" if exists $ +supermatrix{$substrate}{$prod}; } }

But there are two problems :-

1.] Its not printing any output.

2.] My list would at max be ~5 to 10% smaller than superarrays(whereas this code will handle output data sparsely). Also I need the output in such a format that there are blanks wherever there isnt a "1".

Actually the quality of the output depends on the number of blanks also, because this output will be then compared to other 20 such outputs. So in that sense the position of "blanks" and "1" is equally important.

In reply to Re^2: A complicated file parsing and 2D array/matrix problem. by zing
in thread A file parsing and 2D array/matrix problem. by zing

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!
  • 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?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    [erix]: that should be "to an already-too-late- project" I think
    [ambrus]: oh yes, we have a pretty good example of that when they reorganized the grill place in the restaurant nearby.
    [ambrus]: it now has two more people working there, and they're serving slower and more expensive.
    [ambrus]: It used to be just a master cook who takes the order and puts the meat and eggs on the open grill plate table, and an assistant who removes them to a plate, adds the side dish, and gives the plate to the people in the queue, plus a cashier.
    [ambrus]: Now it has five people instead of three, some sort of call number ticket system where people wait a lot for their food to get ready (it's the same kinds of grilled meat and fish on the same equipment, it won't actually fry slower),
    [ambrus]: it's slow as hell, and the food costs significantly more.
    [ambrus]: We no longer eat there.
    LanX Everybody quotes it, some people read it, and a few people go by it
    [ambrus]: LanX: why would I read it? isn't it a book for managers? I don't want to be a manager.
    [ambrus]: I don't quote it either.

    How do I use this? | Other CB clients
    Other Users?
    Others meditating upon the Monastery: (13)
    As of 2017-09-22 13:51 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      During the recent solar eclipse, I:









      Results (264 votes). Check out past polls.

      Notices?