in reply to Accumulating Column Total for a Particular Key

Since Limbic~Region's excellent response mentions DBD::CSV but then gives an example that doesn't use it, here's an example that does use it:
#!/usr/bin/perl use warnings; use strict; use DBI; my $dbh = DBI->connect( 'dbi:CSV:', undef, undef, {RaiseError=>1,PrintError=>0} ); $dbh->csv_tables->{Log} = { file => 'yourfile.csv' }; my( $oms_cpu_total ) = $dbh->selectrow_array(" SELECT SUM(cpu_minutes) FROM Log WHERE application = ? ",{},'OMS'); printf "Application %s used %d CPU minutes\n", 'OMS',$oms_cpu_time; __END__
Note : you will need to change the column headings to be valid SQL column names. The easiest way is to just change spaces to underscorse, e.g. "cpu_minutes".