sample.perl.txt 328 B

123456789101112131415161718
  1. #!/usr/bin/perl
  2. use strict;
  3. use warnings;
  4. use Path::Tiny;
  5. my $dir = path('foo','bar'); # foo/bar
  6. # Iterate over the content of foo/bar
  7. my $iter = $dir->iterator;
  8. while (my $file = $iter->()) {
  9. # See if it is a directory and skip
  10. next if $file->is_dir();
  11. # Print out the file name and path
  12. print "$file\n";
  13. }