7.12. process csv file (short version)

Example 7-8. examples/arrays/process_csv_file_short.pl

while (<>) {
    $sum += (split ",")[2];
}
print "$sum\n";


Use the following command to run the script:

perl examples/arrays/process_csv_file_short.pl examples/arrays/process_csv_file.csv

See also the oneliners


If you are interested in on-site trainings by the author, please contact me directly.

Online courses:

Would you like to get
updated when I publish
the next article?

Follow me:

Google Plus Twitter RSS feed