my %csahash; my $line=<>; while($line=<>){ if($line=~ /\b(\d\w{3})\b/){ $csahash{$1}++; } } #### 2buf= 48 1lsj= 6 2bp7= 12 1ye6= 36 8icc= 1 1a2n= 4 1lz6= 2 1pw1= 5 1e4d= 4 2f8j= 28 1iw8= 24 1qbd= 2 1kf4= 7 1z53= 3 1gxx= 2 1dd6= 10 1ke5= 10 2og7= 1 #### %cathhash; my $line2=<>; while($line2=<>){ if($line2=~/\b(\d\w{3})\b/){ $cathhash{$line2}++; } } #### my %csahash; my $line=<>; while($line=<>){ if($line=~ /\b(\d\w{3})\b/){ $csahash{$1}++; } } %cathhash; my $line2=<>; while($line2=<>){ if($line2=~/\b(\d\w{3})\b/){ $cathhash{$line2}++; } } foreach my $key(keys %csahash){ if(defined $cathhash{$key}){ print "$key matches. It's values are $csahash{$key} and $cathhash{$key}\n"; } }