in reply to Need Help With Loops

You need to consider the logic of your situation. When exactly do you want to announce that there wasn't a match? Since the answer is "I also want to return a message if a phone number in the input file is not found", then clearly you should only perform output after you have reviewed the entire input file. That should give you an idea of where in your code the output should go - combine that with the idea of a $found variable that gets changed when you find what you are looking for, and you have your solution.