use strict; use warnings; use Tie::File; my $first = shift || die "first file\n"; my $sec = shift || die "second\n"; tie my @first,'Tie::File',$first or die "tie error $!\n"; tie my @sec ,'Tie::File',$sec or die "tie error $!\n"; my (%h1,%h2,%common); print "processing $first\n"; map { if(/^\s*(\?.*?)\s/) { $h1{$1}++; } } @first; print "processing $sec\n"; map { if(/^\s*(\?.*?)\s/) { $h2{$1}++; } } @sec; print "finding common keys\n"; map { if(exists $h2{$_}) { $common{$_}++; } } keys %h1; print "there are @{[length keys %common]}:\n"; system("pause"); for my $key(keys %common) { print "\n\n\n$key\n\n\n"; } untie @first; untie @sec;