for my $file (qw(files.txt data.txt)) { if ( -f $file) { unlink $file or warn "Unable to unlink '$file': $!"; } }