Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1194044]
help
Chatterbox?
NodeReaper says "Shhhh! Be vewy vewy quiet, I'm hunting wumpus"

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (9)
As of 2017-09-25 11:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    During the recent solar eclipse, I:









    Results (280 votes). Check out past polls.

    Notices?