%cathhash; my $line2=<>; while($line2=<>){ if($line2=~/\b(\d\w{3})\b/){ $cathhash{$line2}++; } }