WORD: foreach $word (@data) { STOP: foreach $stop (@stopwords) { next WORD if $word eq $stop; # <--- } push(@lessWords, $word); } #### my %stops = map {$_,undef} @stopwords; for my $word (@data) { next if exists $stops{$word}; push(@lessWords, $word); }