if ( grep $term =~ /^(.*)$term(.*)$/, @terms ) { #remove the value that $term matched from the array } # end-if #### $_ =~ /^(.*)$term(.*)$/