Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^2: average a column in tab-delimited file

by garyboyd (Acolyte)
on Jan 30, 2012 at 10:36 UTC ( #950743=note: print w/ replies, xml ) Need Help??


in reply to Re: average a column in tab-delimited file
in thread average a column in tab-delimited file

thanks for all the suggestions, and yes the output should look like the output that anonymous monk posted above.

I can read the file into an array, but I wasn't sure how to proceed through the array to average columns 6 and 7.

#!/usr/bin/perl use strict; use warnings; use Getopt::Long; my $infile; my @fields; my $i; my $j; GetOptions ( "infile=s" => \$infile, ); open INFILE, "<$infile" or die $!; #open RES, ">result.txt" or die $!; while (<INFILE>){ @fields = split(/\t+/, $_); my ($name, $chr, $location, $gen, $dom, $pval, $fst) = @fields +[0..6]; }


Comment on Re^2: average a column in tab-delimited file
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://950743]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2015-07-07 11:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (88 votes), past polls