while( 1 ) { ## prompt user if( $whatever eq 'done' ) { last; } if( $whatever eq 'try again' ) { next; } ## deal with other cases }