# Accepts one argument: the full path to a directory. # Returns: A list of files that end in '.html'. sub get_new_htmls { my $path = shift; opendir (my $dh, $path) or die "Unable to open $path: $!"; my @files = map { $path . '/' . $_ } grep { !/^\.{1,2}$/ } readdir ($dh); # Rather than using a for() loop, we can just # return a directly filtered list. return grep { (/\.html$/) && (! -l $_) } map { -d $_ ? get_new_htmls ($_) : $_ } @files; }