Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: printing contents of small files into one larger one

by mlh2003 (Scribe)
on Nov 09, 2005 at 11:50 UTC ( #507034=note: print w/replies, xml ) Need Help??


in reply to printing contents of small files into one larger one

Depending on the actual size of your files, you could (this is pseudocode, sorry):

1. loop through each file (open file, slurp into an array, close file).
2. Add the array data to a 2-D array (each 'row' of the array would contain the data from each file).
3. Do a transpose on the 2-D array to get the data in the format you want.

This method would require 2 loops: The first to read the data from the files and add to the array. The second to transpose (which would be a simple 2-D nested loop).
_______
Code is untested unless explicitly stated
mlh2003
  • Comment on Re: printing contents of small files into one larger one

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2021-10-26 22:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (91 votes). Check out past polls.

    Notices?