in reply to searching for multiple strings in a line
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"; }
|
|---|