#!/usr/bin/perl -w

use strict;

my %records;
opendir(DIR,$ARGV[0]);
while(my $file = readdir(DIR)){
   if ($file =~ /.gmt/) {
      open IN, $file|| die "$!";
      while(<IN>){
         chomp;
         my @tem = split(/\t/);
         foreach my $ele (@tem) {
          if($ele =~ /^\d+$/) {
             $records{$ele} = 1;
          }
         }
      }
      close IN;
   } 
}
closedir(DIR);


foreach my $key (keys %records) {
   print $key,"\n";
}

