I'm not a Perl hacker (normally), but my copy of the Camel book says that "last" should break out of a loop.
Other than that I suppose you could throw an exception and catch it later...
HTH, -Ryan Wilcox
On Friday, June 13, 2003, at 04:20 PM, Thomas De Groote wrote:
Add an extra variable and set that, like
$exitloop = false; while(<FH> || $exitloop){ if($line eq "__END__"){ $exitloop = true; } # Do other stuff here... }
On Friday, June 13, 2003, at 01:16 PM, Nicholas G. Thornton wrote:
I have a program I'm working on that reads a text file and does stuff with it.
Thing is I want to exit from the while(<FH>) loop prematurely if, say, the line
is '__END__'. I can't figure out how to do this, exit and return don't work, any
ideas?
~wren