foreach my $a (@b) { !... && do {do_something(); 1} && !... && do {do_something_else(); 1} && !... && do_something_again(); perform_cleanup(); }