my $bad = 0; MAIN: { # Main code section. print "Main block\n"; $bad = 1; next MAIN if $bad; last MAIN # This must be the last line of the main # block to execute. } continue { # Close open filehandles, reset globals, etc. print "Continue block\n"; if ( $bad ) {$bad=0; redo MAIN;};