my $success = 1; for my $file (qw(files.txt data.txt)) { if (!unlink($file) && !$!{ENOENT}) { warn("Unable to unlink '$file': $!"); $success = 0; } } die("Unable to cleanup") if !$success;