Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Comment on

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

zing:

You oversold your problem. It's a very basic question, not a complicated one. So beginners may skip over your question, thinking that it'll need complex methods and/or algorithms, so you'll lose some possible responses. When others see the question, they'll see that it's quite simple and not interesting enough to solve, so you'll lose a lot of other possible responses.

I could just drop some code on you, but that wouldn't be very educational. What have you tried? What algorithm(s) have you considered? For simple problems, many monks want to see you put some effort into it: i.e. an attempt to solve the problem. I don't really see any effort expended, and we're not a code-writing service. If you had a problem with some code, I'd've offered some specific suggestions. If it were truly a complicated problem, and interesting enough, I might've spent some time playing with it.

Having said all that, here are a couple of hints for you:

First, if it's going to be a sparse matrix, you might consider a hash instead of an array.

You can build the structure as you read it, rather than building two arrays and then merging the arrays.

...roboticus

When your only tool is a hammer, all problems look like your thumb.


In reply to Re: A complicated file parsing and 2D array/matrix problem. by roboticus
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!
  • 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 taking refuge in the Monastery: (14)
    As of 2014-07-25 10:12 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      My favorite superfluous repetitious redundant duplicative phrase is:









      Results (170 votes), past polls