If you use a hash to record your results you don't need to slurp the file and can generate a little more information. Consider:
use strict;
use warnings;
my %matches = map {$_ => 0} qw(january february egypt);
while (<DATA>) {
chomp;
++$matches{$_} if exists $matches{$_};
}
for my $word (sort keys %matches) {
if (! $matches{$word}) {
print "Didn't find $word.\n";
} elsif (1 == $matches{$word}) {
print "Found $word once.\n";
} else {
print "Found $word $matches{$word} times.\n";
}
}
__DATA__
january
february
january
moon
saturday
Prints:
Didn't find egypt.
Found february once.
Found january 2 times.
True laziness is hard work