Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

I have a csv files which have variable number of columns I would like to read them and put into database. In this process i would like to add all the columns after 8th into 1 filed separated by "comma (,)".

sample input data

85731847 6760 4 20100707 0 = 50 50
53801116 6249 4 20100707 0 = 40 40
87248409 10370577 4 20100707 0 = 10 10
87248410 10768953 4 20100707 0 = 50 50 1.2 1.5 9.7 101
87248420 10047438 4 20100707 0 = 50 50 1.2 1.5 9.7 101

sample output data

85731847 6760 4 20100707 0,=,50,50
53801116 6249 4 20100707 0,=,40,40
87248409 10370577 4 20100707 0,=,10,10
87248410 10768953 4 20100707 0,=,50,50,1.2,1.5,9.7,101
87248420 10047438 4 20100707 0,=,50,50,1.2,1.5,9.7,101

Thanks in advance.

Replies are listed 'Best First'.
Re: Csv file reader
by viveksnv (Sexton) on Feb 21, 2011 at 06:08 UTC
Re: Csv file reader
by GrandFather (Saint) on Feb 21, 2011 at 06:17 UTC

    What have you tried and where did you come unstuck? As suggested above using a module to parse your CSV file is a good start. Beyond that it's hard to know where you are having difficulty unless you tell us.

    True laziness is hard work