Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: arrange output in columns

by graff (Chancellor)
on Jun 17, 2013 at 18:00 UTC ( #1039431=note: print w/replies, xml ) Need Help??


in reply to arrange output in columns

In terms of pseudo-code, your task sounds sort of like this:
declare a "master" array that will hold a set of arrays declare a max_array_size variable, initially set to zero for each input file { read its lines into a new array if the size of this array (# of lines in file) > max_array_size { update max_array_size to this new value (size of current array) } push a reference to this array onto the "master" array. } for each index ( 0 .. max_array_size -1 ) { join the values at master[0..$#master][index] into a comma-delimite +d string # note that some of the values in that set may be undef print the resulting string }
HTH.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1039431]
help
Chatterbox?
[Lady_Aleena]: marioroy, the find worked fine at the command line.
[marioroy]: LA, yeah. than there's no reason why it cannot work inside qx. But chatting is hard in PM. I cannot see the code now.
[shmem]: Lady_Aleena: sometimes a quick glance isn't enough.
[Lady_Aleena]: What?! Can't stat ~/Music: No such file or directory? The ~/ doesn't expand?

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (10)
As of 2017-04-23 21:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (432 votes). Check out past polls.