# 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; } #### Sample "Hello, World" Application

Sample "Hello, World" Application

This is the home page for the HelloWorld Web application.

To prove that they work, you can execute either of the following links:

##
## #!/usr/bin/perl use strict; use warnings; use Data::Dumper; 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; } my @returned_files = get_new_htmls("/home/tinyos/Monks"); print Dumper \@returned_files; __END__ perl test.pl $VAR1 = [ '/home/tinyos/Monks/index.html' ]