use strict; use warnings; use feature 'say'; use Path::Iterator::Rule; my $dir = '1230046/public_html/software'; my $_numMissing = 0; my $_filesThere = 0; my $r = Path::Iterator::Rule->new->file->exists->and(sub { my $wanted = $_[0] =~ s!software/!!r; -e $wanted ? $_filesThere++ : $_numMissing++ && say "$wanted is missing"; })->all($dir); say " Found: $_filesThere"; say "Missing: $_numMissing"; __END__