Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: arrange output in columns

by lee_crites (Beadle)
on Jun 17, 2013 at 18:28 UTC ( #1039440=note: print w/ replies, xml ) Need Help??


in reply to arrange output in columns

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


Comment on Re: arrange output in columns
Re^2: arrange output in columns
by LanX (Canon) on Jun 18, 2013 at 13:39 UTC
    > <h1>homework???</h1>

    morbus headlineritis???

    Cheers Rolf

    ( addicted to the Perl Programming Language)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1039440]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (5)
As of 2014-12-25 08:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (159 votes), past polls