open(FILEHANDLE, "steve_list_plaintext.txt"); while() { @words = split(/ /, $_); while($words[0] =~ /^[A-Z]\./) { shift @words; } chomp $words[0]; $fields{$words[0]}++; } close(FILEHANDLE); open(FILE2, "di_list_plaintext.txt"); while() { @words = split(/ /, $_); while($words[0] =~ /^[A-Z]\./) { shift @words; } chomp $words[0]; if($fields{$words[0]} > 0) { print "$_"; } }