in reply to This is just wonky...

This is interesting! I see your point! I'm trying more tests now...Got it I hope!

Update: Ok, my wonky guess is that the pattern match returns a null string (not undef) from the '!~' which in an if statement is FALSE of course!

I think the index function technique may be faster if you're not using other pattern matching metacharacters. Run below to see what I think may explain the problem.

use strict; my $exclude = 'middle_name pager zip'; my $lookfor='pager'; my $lookfor2='wonk'; # This would work without using pattern matching: # Note lc function used to ignore case! my $pos=index(lc($exclude),lc($lookfor),0); if ($pos > -1) {print "Found $lookfor !\n";} $pos=index(lc($exclude),lc($lookfor2),0); if ($pos == -1) {print "Cannot find $lookfor2 !\n";} print "\n"; my $look=($exclude =~ /$lookfor/gi); my $look2=($exclude =~ /$lookfor2/gi); my $notlook=($exclude !~ /$lookfor/gi); my $notlook2=($exclude !~ /$lookfor2/gi); print "'\$exclude =~ /$lookfor/gi' evaluates to '$look'\n"; print "'\$exclude =~ /$lookfor2/gi' evaluates to '$look2'\n"; print "'\$exclude !~ /$lookfor/gi' evaluates to '$notlook'\n"; print "'\$exclude !~ /$lookfor2/gi' evaluates to '$notlook2'\n"; __END__

..:::::: aquacade ::::::..