{ last unless (my $once = $condition1) and $condition2; while(1) { # ... # ... last if $once or not $condition3; } } #### { last unless (my $once = $condition1) and $condition2; do { # ... # ... } while not $once and $condition3; }