open( LIST, "stopwords.txt" ) or die "$!"; my @stopwords = ; chomp(@stopwords); # <- was missing my %stopwords; # Create an element in the hash for each stop word. undef @stopwords{@stopwords}; #### # Create an element in the hash for each stop word. my %stopwords; open( LIST, "stopwords.txt" ) or die "$!"; while () { chomp; undef $stopwords{$_}; }