I have a perl script that outputs monthly statistics from a database. These are summarised in a table using the following snippet of code
print $fh <<END;
This report details clinical and imaging statistics from $date_start to $date_stop.
\\large \\bf Clinical Statistics
\\normalsize \\rm
\\begin{table}[h]
\\centering
\\begin{tabular}{p{4cm}cccccccc}
\\hline
& $operator[0] & $operator[1] & $operator[2] & $operator[3] & $operator[4] & $operator[5] & $operator[6] & $operator[7] \\\\
\\hline
Cannulations & $venflons[0] & $venflons[1] & $venflons[2] & - & $venflons[4] & $venflons[5] & $venflons[6] & $venflons[7] \\\\
Clinical Assessments & $clin_ass[0] & $clin_ass[1] & $clin_ass[2] & - & $clin_ass[4] & $clin_ass[5] & $clin_ass[6] & - \\\\
Lead Stressor & $etlead[0] & $etlead[1] & $etlead[2] & - & $etlead[4] & $etlead[5] & $etlead[6] & $etlead[7] \\\\
Assistant Stressor & $etass[0] & $etass[1] & $etass[2] & - & $etass[4] & $etass[5] & $etass[6] & - \\\\
ECG Preparation & $ecg_prep[0] & $ecg_prep[1] & $ecg_prep[2] & $ecg_prep[3] & $ecg_prep[4] & $ecg_prep[5] & $ecg_prep[6] & - \\\\Patient Identification & $patient_id[0] & $patient_id[1] & $patient_id[2] & $patient_id[3] & $patient_id[4] & $patient_id[5] & $patient_id[6] & - \\\\
\\hline
\\end{tabular}
\\end{table}
END
Basically the perl script queries various tasks for each operator and stores the number of counts in each field. Operator is a perl array and is likely to change size by 1 or 2 values, i.e is likely It is likely that the operator array may change with time (i.e new initials added or removed). In such cases I would have rewrite the latex table part of my script i.e adding $operator[8] etc. I'm sure there is a more sensible approach to this problem using loops but I can't work out how to achieve this.
Any ideas?