in reply to Counting items in a CSV
well here's some code, hopefully easy enough to understand...name,date,size name1,date1,120 name2,date2,140 name3,date3,150
Its up to you, you can use the Statistics::Descriptive module to get much more information (sum, mean, median standard deviation etc) from your data as well, or maybe if you just need a simple sum you can add the elements of the array yourself.use strict; use Data::CTable; use Statistics::Descriptive; my $data = Data::CTable->new("data.txt"); # your csv file $data->clean_ws(); # clean up whitespace my $sizecolumn = $data->col('size'); # get column by name my $stat = Statistics::Descriptive::Full->new(); $stat->add_data($sizecolumn); print "sum of the column size:", $stat->sum() , "\n";
perliff
----------------------
-with perl on my side
|
|---|