(my $res = system @args) and unlink $to_delete; #### UFILE: while (@files) { #... system @args and do { unlink $to_delete; print LOG "'system @args' failed: ", $?; next UFILE; }; system @other_args and print LOG "'system @other_args' failed: ", $?; #... }