foreach my $filename (@arr) { $x = File::Spec->catfile($path, $filename); unlink $x; }