#!/usr/bin/perl use warnings; use strict; my %bow1 = (); my $file1 = shift; open (FILE1, "$file1"); # Open first file while () { my ($ID1, undef, undef, undef, $Seq1) = split; $bow1{$ID1}[0] = $ID1; $bow1{$ID1}[1] = $Seq1; } close FILE1; my %bow2 = (); my $file2 = shift; open (FILE2, "$file2"); # Open second file while () { my ($ID2, undef, undef, undef, $Seq2) = split; $bow2{$ID2}[0] = $ID2; $bow2{$ID2}[1] = $Seq2; } close FILE2; for my $ID1 (keys %bow1) { for my $ID2 (keys %bow2) { if (defined $bow1{$ID1}[0] and defined $bow2{$ID2}[0]) { if ($bow1{$ID1}[0] eq $bow2{$ID2}[0]) { if ($bow1{$ID1}[1] =! $bow2{$ID2}[1] ) { print "$bow1{$ID1}[0]\t$bow1{$ID1}[1]\t$bow2{$ID2}[0]\t$bow2{$ID2}[1]\n"; } } if ($bow1{$ID1}[0] ne $bow2{$ID2}[0]) { print "\nIDs do not match\n"; print "$bow1{$ID1}[0]\t$bow1{$ID1}[1]\t$bow2{$ID2}[0]\t$bow2{$ID2}[1]\n"; } } } } exit;