|The stupid question is the question not asked|
Compare 2 CSV files and create a new CSV file out of comparisionby slayedbylucifer (Scribe)
|on Jul 02, 2012 at 08:53 UTC||Need Help??|
slayedbylucifer has asked for the
wisdom of the Perl Monks concerning the following question:
I have 2 .csv files as below:
Compare the 1st field of (vm_name) the two files and if they match then write it to a 3rd CSV file with the column headings as mentioned below (Each row of this 3rd CSV should conain all information about a given vm from both the CSVs files. Basically, I am trying to merge two files lokking at the 1st field.)
Here is my code which not correct But you will get the idea what I am trying to do:
The logic I used:
retrieve the 1st element of the vm.csv and comapre it with the 1st elements of all the rows of the vFiler.csv. if there is match, then write a new line whihc contains repsective elememnts to a new file called new.csv.
this is not working.
I think nested while loop is a horrible practice. anyway, it is not working either.
I am not able to find a way to write "Column_names" with Text::CSV hence using Class:CSV and still it is not working.
I am pretty sure there is a better apporach to do this. Could you help. thanks.