Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Re: How to combine multiple files together

by kirbyk (Friar)
on Oct 17, 2005 at 15:57 UTC ( #500761=note: print w/replies, xml ) Need Help??

in reply to How to combine multiple files together

(First, nitpick: it's 'csv' files. 'comma-separated-values'. cvs is a version control system.)

It's probably a good idea to use the Text::CSV_XS module to parse and recombine your csv files. This easily lets you get them into convenient array form.

Then, I'd store the arrays in a hash based on the first key. If the hash already has an array assigned to it, you can append to the existing array. (Or whatever you need to do. It's not exceedingly clear from the question. But this should be a good way to group them together.)

At the end, you can do a foreach on the keys of the hash, and combine the fields using the module, and write that out to a new csv file.

Hope this points you in the right direction!

-- Kirby,

  • Comment on Re: How to combine multiple files together

Replies are listed 'Best First'.
Re^2: How to combine multiple files together
by xspikx (Acolyte) on Oct 17, 2005 at 16:01 UTC
    Thanks, Now I got some good ideas on how to get it done properly.

Log In?

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

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

    Results (126 votes). Check out past polls.