foreach my $file (glob "/tmp/somedir/file*.xml") { unlink $file or die "ERROR: Couldn't delete file '$file': $!"; }