#!/usr/bin/perl -w use strict; use warnings; foreach my $file (glob("dir/FILE:*")) { if (!unlink($file)) { print "Warning: failed to remove file '$file' ($!)\n"; } }