I fail to see your problem. Perl only goes as many times
through a file as you tell it to. In the code you give,
you scan the file once, and only once. And unless you seek
back to the beginning and enter the loop again, Perl isn't
going through the file again.
in reply to Search Efficiency
I get the feeling you didn't give us all the code, but if
you do, I expect the answer to be "don't do that then".
Note that if you want Perl to stop reading the file in its
current iteration, look at the last; statement.