for my $file (qw(files.txt data.txt)) { unlink($file) or $!{ENOENT} or die("Unable to unlink '$file': $!"); } #### 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;