open(S, "Lexicon.txt"); while($sa=){ ($POS, $Lemma) = split('\t',$sa); $emotive{$Lemma}=$POS}; open(File, 'eng.txt'); while($text = ){ #this is some preprocessing for the text $text =~ s/\s+/ /g; $text =~ s/,/ ,/g; $text =~ s/æ/ æ/g; $text =~ s/\?/ !/g; #$text =~ tr/A-Z/a=z/; @words = split(' ', $text); for $word(@words){ if(exists $emotive{$word}){ print $word }}};