use strict; use warnings; use Data::Dumper; open (FILE, "/Users/Pabli/Desktop/gene_association.goa_human"); open (FILE2, "/Users/Pabli/Desktop/go3.obo"); $main::mio; $main::mio2; $main::mio4; $main::words2; my $i=0; my %go_accession_hash=(); while() { my @array_with_all_fields=split(/\t/); if ($array_with_all_fields[2] eq "TP53"){ $mio=$array_with_all_fields[4]; open my $out_file, '>>', 'myoutputfilename.txt' or die "$!"; #print "".$mio."\n"; print $out_file $mio; # print to file } } open (FILE3, "/Users/Pabli/Documents/workspace/PerlProva/myoutputfilename.txt"); while($line=){ @words2 = split(" ",$line); #print "$words2[1]\n"; $i=5; while($line2=){ $i = $i - 1; if ($i >= 0) { @words = split(" ",$line2); } } print $words[0]."\n"; #if ($words2[0] eq "id:") { #$mio4=$words2[1]; #print $mio4."\n"; # } #elsif ($words2[0] eq "name:"){ #if ($mio4 == $mio2){ #print "name: ".$words2[1]."\n"; #} #} #} } close FILE; close FILE2; close FILE3;