darren@dino:~/perl$ cat words.txt january february egypt moon saturday darren@dino:~/perl$ cat missing.pl #!/usr/bin/perl use strict; use warnings; my $word_file = 'words.txt'; my @required_words = qw/january larry_wall february holiday egypt moon saturday/; my %words; open my $in, '<', $word_file or die "$!\n"; while (my $line = <$in>) { chomp $line; $words{$line}++; } close $in; for my $word (@required_words) { if ($words{$word}) { print "Required word $word is present\n"; } else { print "Required word $word is missing\n"; } } darren@dino:~/perl$ perl missing.pl Required word january is present Required word larry_wall is missing Required word february is present Required word holiday is missing Required word egypt is present Required word moon is present Required word saturday is present