Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

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, WhitePages.com


Comment on Re: How to combine multiple files together
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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2014-10-25 09:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (142 votes), past polls