#!/usr/bin/perl #Naga_betrapally_6_3_16 use strict; use warnings; use Cwd; use FileHandle; my $name; # Naming of variables, remembers the name of the file my $cwd = getcwd(); #Takes in the current directory of files my $opendir = "$cwd"; #Used to open the current directory and remembers the location opendir (DIR, $opendir) or die $!; #Open directory command my @directory = readdir DIR; #Grabbing all the fas files stored in the location my $scalar = scalar(@directory); #Counting the number of files and printing it in the next line #print "The number of sample files in this folder: $scalar \n"; # for (my $i=0; $i){ chomp $file; if ($file =~/^Name/){ $header = $file; } else{ $array_lines[$n] = $file; chop $array_lines[$n]; $n++; } } for(my $i=0;$i<@array_lines;$i++){ my @tmp = split(/\t/,($array_lines[$i])); #print $tmp[3]; push @average_array, $tmp[3]; my $scalar = scalar(@average_array); #print $scalar; } foreach (@average_array){ #print "$_\n"; my $tmp = $_; $tmp =~ s/,//; #print "$tmp\n"; $sum = $sum+$tmp; } #print "The sum of all the mapping is $sum\n"; $avarage = $sum/11; #print "THe average of the mapping is $avarage\n"; close (FILE); }