sub Get_FileList{ @files=(); @todel=(); $logger->info(Carp::longmess("TRACE1")); find (sub { $logger->debug("Reached $File::Find::name"); $logger->info(Carp::longmess("TRACE2")); push @files,$File::Find::name if (-f $File::Find::name and /\.*$/ and stat($File::Find::name)->mtime > $lastepoch); push @todel,$File::Find::name if (-d $File::Find::name);}, $indir); $logger->info(Carp::longmess("TRACE3")); $lastepoch = time; #Update last execution time for the next run $logger->info("New execution time update: $lastepoch."); $proccount = scalar(@files); $logger->info("Found $proccount new files since last run."); } #### 04-12-2017 04:06:56:570 INFO TRACE1 at perl.pl line 85. 04-12-2017 04:06:56:577 DEBUG Reached Z:/ 04-12-2017 04:06:56:577 INFO TRACE2 at C:/Strawberry/perl/lib/File/Find.pm line 358. File::Find::_find_dir(HASH(0x5174bd8), "Z:/", 1) called at C:/Strawberry/perl/lib/File/Find.pm line 236 File::Find::_find_opt(HASH(0x5174bd8), "Z:/") called at C:/Strawberry/perl/lib/File/Find.pm line 760 File::Find::find(CODE(0x4e8b7b8), "Z:/") called at perl.pl line 118 main::Get_FileList() called at perl.pl line 85