in reply to group by and sum for two columns

In addition to the advice shared by hippo above about implementing strict and warnings before all else, you should also consider using a dedicated module to parse your CSV file, e.g. Text::CSV_XS. Or even better, since you are apparently wanting to filter on date range and so forth, use DBD::CSV and query the data using SQL, possibly using a query builder like SQL::Abstract.


The way forward always starts with a minimal test.