My first and second CSV file contain the following data. Now I want to insert the data of second file into the first one so that I will the data as shown in final.csv.
First.csv
e_id,e_sal,e_loc
001,20000,mumbai
002,40000,newyork
Second.csv
e_name,e_mngr
raj verma,vineet kothari
sundar prasad,danney morena
Final.csv
e_id,e_name,e_sal,e_mngr,e_loc
001,raj verma,20000,vineet kothari,mumbai
002,sundar prasad,40000,danney morena,newyork
I am trying with this piece of code. But it appends only.
while (!eof($fh1) and !eof($fh2)) {
my $line1 = <$fh1>;
my $line2 = <$fh2>;
my @l1 = split /\s+/, $line1;
my @l2 = split /\s+/, $line2;
push (@l1, @l2);
}