| Next | The Identity Function | 31 |
sub print_files {
my ($dir) = @_;
if (-d $dir) {
print $dir, "\n";
opendir my $dh, $dir or return;
while (my $file = readdir $dh) {
next if $file eq '.' || $file eq '..';
print_files("$dir/$file");
}
} else {
print $dir, "\n";
}
}
This works, but we can do better
We will abstract out the printing behavior
| Next | ![]() |
Copyright © 2001 M. J. Dominus |