perl how to exit a while loop and quit reading the input file

I am reading a file using While loop

while <FILE>
{
  $_ = <FILE>; 
  process data... 

}

I would like to quit reading the file once I encounter a String pattern. How do i do it.

is it

 if (/SUMMARY/)
 { 
  last; 
 }

I am having problems with uninitialized value in pattern matching and substitution and the while Loop does not end. Don't know how to get around that either..

thanks

Yep, how do you do this way ?

when in while (<FILE>) itself, you would get the line into $, then why are you again reading into $.

Remove that line. And if you have some other errors, come again with more clarity.