#!/usr/bin/perl use warnings; my $file = "test.txt"; my @x; my @id; my @marker; my @allelA; my @allelB; my @quality; my @probA; my @probB; my $laenge_x; my $file_mach = "test2.txt"; my @mach; my @id_mach; my @marker_mach; my @allelA_mach; my @allelB_mach; my @quality_mach; my @probA_mach; my @probB_mach; my $laenge_mach; open( IN, "<$file" ) or die "Konnte Input nicht oeffnen!\n"; while () { chomp($_); @x = split(/\t/, $_ ); push(@id, $x[0]); push(@marker, $x[1]); push(@allelA, $x[2]); push(@allelB, $x[3]); push(@quality, $x[4]); push(@probA, $x[5]); push(@probB, $x[6]); } close(IN); open (IN2, "<$file_mach"); while () { chomp($_); @mach = split(/\t/, $_ ); push(@id_mach, $mach[0]); push(@marker_mach, $mach[1]); push(@allelA_mach, $mach[2]); push(@allelB_mach, $mach[3]); push(@quality_mach, $mach[6]); push(@probA_mach, $mach[4]); push(@probB_mach, $mach[5]); } close(IN2); my $together = 0; my $mach = 0; my $x = 0; for my $i (1..$#id){ for my $j (1..$#id_mach){ if ( $id[$i] eq $id_mach[$j] and $marker[$i] eq $marker_mach[$j] and $allelA[$i] eq $allelA_mach[$j] and $allelB[$i] eq $allelB_mach[$j]) { $together++; } } } print $together;