Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

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


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

Replies are listed 'Best First'.
Re^2: arrange output in columns
by LanX (Bishop) on Jun 18, 2013 at 13:39 UTC
    > <h1>homework???</h1>

    morbus headlineritis???

    Cheers Rolf

    ( addicted to the Perl Programming Language)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1039440]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2018-06-24 13:58 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (126 votes). Check out past polls.