Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Comment on

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

homework???

This just feels like a homework assignment, so I'll answer in plain english, and let you translate it into perl. After all, it does you no good to have someone with three dozen years of experience do your homework, right?

Read the files, one by one. Nothing is mentioned about how you get the list of files, so I assume you know what is needed to get the next file name, open the file, and read the information in.

I would keep up with the number of the file being processed (0 for first, 1 for second, etc) and the number of the line read in (0 for first, etc). Then build a two-dimensional array with the data ($goo{linenum}{filenum}). This means you have all of your data in one pass through the files.

Then report the information, going first by "linenum" and "joining" them together. There is a good chance you will have missing items in the two-dimentional array, so that is something you will have to keep in mind.

I am betting this assignment requires extensive use of for loops, so that is something you should go back into the text and find.

Once you have something working, and want some help with debugging or whatever, that is something you might want to post for comment.

Lee Crites
lee@critesclan.com

In reply to Re: arrange output in columns by lee_crites
in thread arrange output in columns by james4545

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 imbibing at the Monastery: (6)
    As of 2014-09-22 03:12 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      How do you remember the number of days in each month?











      Results (178 votes), past polls