in reply to searching for multiple strings in a line

I am assuming there is only 1 statement per file? You are just looking for more than one control statement? ie 2 selects, two deletes or one of each? I would most likely take a slightly different approach to most, I am sure you will get a dozen replies on the benefits of using maps for this, but a simple method could be something like this:
open(INFILE, "filename.txt"); my %hash; while(<INFILE>) { chomp; foreach my $e (split / /, $_) { defined($hash{uc($e)}) ? $hash{uc($e)} = 1 : $hash{uc($e)} += 1; } } if ( ($hash{'SELECT'} > 1) || ($hash{'DELETE'} > 1) ) { print "There is a nested SQL in this file\n"; } elsif ( ($hash{'SELECT'} >= 1) && ($hash{'DELETE'} >= 1) ) { print "There is a nested SQL in this file\n"; } else { print "File is fine\n"; }