Blob
1 #!/usr/bin/perl3 # Read the list of files in the current directory and convert the names to4 # their full path specification. Don't use the shell or an external program5 # to get the current directory. The File::Spec and Cwd modules, both of which6 # come with Perl, should help. Print each path with four spaces before it and7 # a newline after it.9 use v5.24;10 use warnings;11 use strict;12 use utf8;13 use File::Spec;14 use Cwd;16 my $dir = getcwd();17 opendir my $dh, $dir or die "Unable to read current directory: $!";18 foreach (readdir($dh)) {19 if ($_ eq "." || $_ eq "..") {20 next;21 }22 printf(" %s\n", File::Spec->catfile($dir, $_));23 }