http://qs321.pair.com?node_id=810938

xbmy has asked for the wisdom of the Perl Monks concerning the following question:

Hi everyone, I met a difficulty. The following data are fluxes' value of N2O emission, I want to calculate the average value of data in second column grouped by column one, because there are thousands of values for N2O-1 and N2O-2,N2O-3,N2O-4...... You know I am just a Perl newby, so can you show me the Perl code to solve the problem? DATA:
N2O-1 0.02 N2O-1 0.47 N2O-1 0.22 N2O-2 0.02 N2O-2 5.87 N2O-2 7.32 N2O-3 3.45 N2O-3 1.81 N2O-3 2.36 N2O-3 4.70 N2O-4 9.60 N2O-4 4.95 N2O-4 6.99
The result of the calculation should be following data:
N2O-1 0.297 N2O-2 4.403 N2O-3 2.54 N2O-4 7.18
I realy appreciated for your help! Thanks for your attention!