in reply to Calculating subtotals from a table

You would benfit greatly from using a hash (datatype), also known as a dictionary. For every line, take the line in, and add it to the element for that year. i.e.

$totals{$year_x}+=$yr_tot;

update Later on, you would use keys %totals to get all years and you can iterate through that via some loop (for,foreach,while...)

----
Give me strength for today.. I will not talk it away..
Just for a moment.. It will burn through the clouds.. and shine down on me.