I'm constantly amazed that people (try to) work with source code which looks like that. I've done only two things to it:
The resulting code is here:
#!/usr/bin/env perl use strict; use warnings; my @a; my $n = "\n"; @a = glob ("*.Recip.blast.top"); my $t = "\t"; foreach my $a (@a) { my @b = split (/[.]/, $a); my $OrginalBlast; $OrginalBlast = $b[0] . "." . $b[1] . "." . $b[2] . "." . $b[3] . "." . $b[4] . "." . $b[5] . "." . $b[6] . "." . $b[7]; #####ORGN is = AB||||||| open (ORGN, "/home/ajl12013/Labwork/Dbfiles/results/$OrginalBlast" +) || die; ######RECI is = BA||||||| open (RECI, $a) || die; open (OUTM, ">MatchingGI.txt") || die; open (OUTNoM, ">NoMatchingGI.txt") || die; my $ORGN = <ORGN>; my $RECI = <RECI>; my %GenomeTable; my $Genome1A; my $G1A; my $data; my $G2A; my $Genome2A; my $l; local $/; my $key; $GenomeTable{$OrginalBlast} = $a; #### First while statement for the AB file. $GenomeTable{$n} = $n; while (my $G1A = <ORGN>) { if ($G1A =~ m/^[gi|]\w/) { ($Genome1A) = $G1A =~ m/^gi\|\d+/g; $GenomeTable{$Genome1A} = []; $GenomeTable{$n}; foreach my $keys (keys %GenomeTable) { print " Keys: $keys + $n"; } } while ($G2A = $RECI) { if ($G2A =~ m/^[gi|]/) { $G2A =~ m/^gi\|\w+\|\w+\|\w+\.\d\|\w+\s(gi\|\d+)/g; $Genome2A = $1; $GenomeTable{$Genome1A} = $Genome2A; foreach my $values (values %GenomeTable) { print "Values: $values $n"; } $Genome1A eq $Genome2A ? print OUTM $a . $n : print OUTNoM $a . $n; } } } }
From this the overall structure of the code is much more apparent to me. Now you can think about applying the other excellent suggestions already given by my learned brethren.
It would also be useful to know which version of Perl you are using when it comes to actually solving your problem.
In reply to Re: How to do a reciprocal matching statement
by hippo
in thread How to do a reciprocal matching statement
by ajl412860
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |