#!/usr/bin/perl -w use strict; foreach ("WORDHERE", "stuffthenWORDHERE", "WORDHEREthenstuff", "stuffbeforeWORDHEREstuffafter", "wordhere", "no_word_here") { print "$_: "; if($_ =~ /WORDHERE/gi) { print "matches"; } else { print "doesn't match"; } print "\n"; }