use strict; my $data = "C:\\dir"; opendir DIR, $data; my @file = grep {/^APPL_RMKS_RCV.200309.*$/ } readdir DIR; closedir DIR; #This produces a screen printout of a number of files in the directory with filenames matching the initial search print @file; unlink @file or die "$!";