1 1ddd2d4e 2023-09-10 jrmu #!/usr/bin/perl
3 1ddd2d4e 2023-09-10 jrmu # Read the list of files in the current directory and convert the names to
4 1ddd2d4e 2023-09-10 jrmu # their full path specification. Don't use the shell or an external program
5 1ddd2d4e 2023-09-10 jrmu # to get the current directory. The File::Spec and Cwd modules, both of which
6 1ddd2d4e 2023-09-10 jrmu # come with Perl, should help. Print each path with four spaces before it and
7 1ddd2d4e 2023-09-10 jrmu # a newline after it.
10 1ddd2d4e 2023-09-10 jrmu use warnings;
13 1ddd2d4e 2023-09-10 jrmu use File::Spec;
16 1ddd2d4e 2023-09-10 jrmu my $dir = getcwd();
17 1ddd2d4e 2023-09-10 jrmu opendir my $dh, $dir or die "Unable to read current directory: $!";
18 1ddd2d4e 2023-09-10 jrmu foreach (readdir($dh)) {
19 1ddd2d4e 2023-09-10 jrmu if ($_ eq "." || $_ eq "..") {
22 1ddd2d4e 2023-09-10 jrmu printf(" %s\n", File::Spec->catfile($dir, $_));