Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

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 a log crumbles through the grate...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (6)
As of 2018-08-15 13:02 GMT
Find Nodes?
    Voting Booth?
    Asked to put a square peg in a round hole, I would:

    Results (160 votes). Check out past polls.