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

Re: Combining two fields of a CSV file

by sundialsvc4 (Abbot)
on Jul 02, 2017 at 14:21 UTC ( #1194044=note: print w/replies, xml ) Need Help??

in reply to Combining two fields of a CSV file

The Text::CSV_XS module shown above would probably be your most-reliable solution.   To elaborate, you would read each line of data, use this module to separate the line into an array of values, then combine the strings as desired ... perhaps, into a new array.   Then, use the same module to construct a new line of CSV-formatted data from the array, which you write line-by-line to a new file.   (Perhaps, a temporary file.)   Notice that this technique purposely does not modify the original input file, allowing the program to be safely re-run while you debug it.   The module does all the dirty work (which can be tricky) of decoding and re-encoding the CSV data.   You simply concern yourself with the values.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (6)
As of 2018-04-20 14:47 GMT
Find Nodes?
    Voting Booth?