my %words = map { $_ => 1 } qw( directory file age action ); while (<>) { print "Could not find '$_' in list\n" unless exists $words{ $_ }; }