<?xml version="1.0" encoding="windows-1252"?>
<node id="993236" title="average of column" created="2012-09-12 10:51:45" updated="2012-09-12 10:51:45">
<type id="115">
perlquestion</type>
<author id="993098">
linseyr</author>
<data>
<field name="doctext">
Hi,

I would like to calculate the average of column 4 from my input files.

&lt;code&gt;
#!/usr/local/bin/perl
#OPEN UP THE FILE
open (MYFILE, '148-N-pvalue0.01_peaks.xls');
   #READ THROUGH THE FILE
   while (my $line = &lt;MYFILE&gt;)
   {
	@arr1 = split('\t',$line);
	@length = @arr1[3];
	$numbers = join(", ",@length);
	print $numbers;
	#print @length,",";
	#$avg = avg($length);
	
} &lt;/code&gt;

But the problem is the array. How do I get commas between the numbers? And at the end calculate the average from the array?

Thanks!</field>
</data>
</node>
