Add numbers taken from a CSV file
Given a CSV file like this:
Tudor;Vidor;10;Hapci
Szundi;Morgo;7;Szende
Kuka;Hofeherke;100;Kiralyno
Boszorkany;Herceg;9;Meselo
Write a script that will take the values of the 3rd in this Comma Separated Values file and add them together.
Can your code also handle this file?
Budapest,Bukarest,1200,km
Tel Aviv,Beirut,500,km
London,Dublin,300,km
New York,"Moscow, East",6000,km
Local,"Remote
Location",10,km
Tools
Solutions in Perl 5
- Perl 5 Process CSV file
- Perl 5 Process CSV file short version
- Perl 5 One-liner sum of column in CSV
- Process CSV file using Text::CSV_XS