On Sep 17, 2012, at 3:23 PM, Chris Stinemetz wrote:
> Sorry forgot you wanted the average.
> Revised program is below:
>
> #!/usr/bin/perl
>
> use strict;
> use warnings;
> use Data::Dumper;
>
> my %hash;
> my $counter;
>
> while ( my $line = ) {
>
>my @record = split( /\s+/, $line );
>
Sorry forgot you wanted the average.
Revised program is below:
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
my %hash;
my $counter;
while ( my $line = ) {
my @record = split( /\s+/, $line );
## check to see if we've already added the 3rd column to the hash
## if we
On Mon, Sep 17, 2012 at 1:29 PM, Wang, Li wrote:
> Dear List members
>
> I have three columns of a table. The example is as follows:
>
> DBS R^2 genename
> 801 0.27807486057281494 POPTR_0002s00200
> 19031.0 POPTR_0002s00200
> 11030.25852271914482117 POPTR_0002s0020
PTR_0002s00210
>
> I would like to calculate the average value of column 2 while the
> content of column three is the same. In this case, I would like the
> output of my result be as follows: R^2 genename 0.3899163577
> POPTR_0002s00200 0.2314956035POPTR_0002s00210
>
>
genename
0.3899163577POPTR_0002s00200
0.2314956035POPTR_0002s00210
I donot know how to deal with columns in Perl. I thought about using the idea
of hash. But the key of a hash could not be the same.
Could anyone please point out me the direction? I would appreciate it very much