use Path::Class qw(dir file); use Time::localtime; my $dirpath = dir("/waslogs1/vfoneLog/cposapp"); my $outfile = file("/home/cpos/CRM_Reports/output/filelist.txt")->openw; my @names = grep { my $st = $_->stat or die $!; localtime($st->mtime)->mon == 8 && # 8 means September localtime($st->mtime)->mday == 3 } $dirpath->children; $outfile->print($_->basename, "\n") for @names; $outfile->close or die $!;