1 #!/usr/bin/perl 2 3 use strict; 4 use warnings; 5 6 #####input##### 7 my $all = $ARGV[0]; my $part_file = $ARGV[1]; 8 9 10 11 #####mian##### 12 13 my $all_in = &store($all); 14 my $part =&store($part_file); 15 16 &check($all_in,$part); 17 18 19 20 #####sub##### 21 22 sub check 23 { 24 my ($a_arr,$p_arr)= @_;my %p=%{$p_arr};my %a=%{$a_arr}; 25 26 foreach my $key(keys %p) 27 { 28 if ($a{$key}) 29 { 30 my %hash_2 = %{$a{$key}}; 31 32 foreach my $key2 (keys %hash_2) 33 { 34 if(($a{$key}{$key2})&&(!($p{$key}{$key2}))){print "$a{$key}{$key2} ";} 35 } 36 } 37 } 38 } 39 40 41 sub store 42 { 43 my $in = shift;open LIST,"$in"; 44 45 my %all; 46 47 while(my $line = <LIST>) 48 { 49 chomp($line);my @split = split / /,$line; 50 51 $all{$split[0]}{$split[1]}=$line; 52 } 53 return %all; 54 }