#!/usr/bin/perl -w use strict; my @data = ( "Some lines of text", "I love my lines of text", "These are nice lines" ); my @stopwords = ( "lines" ); my @lessWords = (); my (@arr,@a); foreach my $word (@data) { push @arr,split(/ /,$word); } WORD: foreach my $a (@arr) { foreach my $stop (@stopwords) { next WORD if $a eq $stop; } push(@lessWords, $a); } print join( ' ', @lessWords ), "\n"; __OUTPUT__ Some of text I love my of text These are nice