sorry what I want to do is return matches of each word in a short statement rather than re iterating through multiple if statements; so that the first match stores the occurrence of each match ie $1 contains weed if matched $2 has dial etc so if the queried scalar contains weed AND dial both are printed. (The code also calls the scalar of the matched file with is the $fasta header part of a foreach loop) or if only one is present one is printed. so match weed and or dial and print the matched quantity. I apologize for being vague I am fairly new at this.