#!/usr/bin/perl use strict; use warnings; my %hash; my($name,$val,@nam); my ($cnt1,$cnt2) = 0; open(WRITE1,">match_name"); open(WRITE2,">nomatch_name"); open(DATA1,") { chomp; ($name,$val) = split(/\t/,$_); $hash{$name}=$name; } close(DATA1); open(DATA2,"name_syn") or die "Check file"; while() { chomp $_; if($_=~/^#/) { next; } @nam = split(/\t/,$_); if (exists $hash{$nam[0]}) { print WRITE1 "$hash{$nam[0]}\t$nam[1]\n"; $cnt1 +=1; } else { print WRITE2 "$hash{$name}\n"; $cnt2 +=1; } } print "$cnt1\t$cnt2\n"; close(WRITE1); close(WRITE2);