#!/usr/bin/perl -w use strict; use warnings; use File::Basename; die "Usage: perl extracting.pl [directory where files are located] \n" unless ($#ARGV ==0); my ($folderin) = @ARGV ; #$dirname = "/data/lgsg/yuho/ProjectSuccess.extracting2columns/sort/geneReadCount" opendir(DIR, "$folderin") || die "cannot openfolder"; my @list = readdir (DIR); closedir(DIR); for(1..2){shift @list;} my ($filecount, $rowcount) = 0 ; my (@filename, @row); foreach my $fileone (@list) { $filename[$filecount] = $fileone; open(RES,"$folderin/$fileone") || die "could nottt open $fileone\n"; ; ; my $count = 0; my $row1; my @genes; while(){ $row1[$count] =(split /\t/)[0]; $count++; } $row[$filecount] = @row1; $filecount++; } my $unmatched = 0 ; my @names; my $filecount1 =$filecount-1; for (my$chr =1; $chr <= $filecount1; $chr++){ if ($row[0] ne $row[$chr]) { $names[$unmatched] =$filename[$chr]; $unmatched++; } } print "Total # of files compared: $filecount \n"; print "Total # of files unmatched: $unmatched\n"; print "name of the files unmatched : @names \n " ;