in reply to DBI and fetchall_arrayref (gosh!)

I'm not familiar with Oracle, but you should be able to use the compute clause in the select statement:
SELECT report_no, reported_by, project_no, to_char(date_reported,'DD-MON-YYYY'), cat1, cat2, cat3 compute avg(cat1), avg(cat2), avg(cat3)

If that doesn't work, try this:

before the first foreach loop:

my @sums;
In the second loop:

$sums[$number] += $element;
At the end you have the sum of each column in @sums and just have to divide each sum by $i, which holds the number of rows.