use warnings; use strict; foreach my $file (<*>) { if ($file =~ m/(.*)/) { #we trust everything from *our* box $file = $1; my $rc = system("rm", $file); } }