Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: glob() and dot files (updated)

by haukex (Archbishop)
on Apr 13, 2020 at 08:19 UTC ( [id://11115428] : note . print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    use File::Spec::Functions qw/ no_upwards catfile catdir /;
    opendir my $dh, $path or die "$path: $!";
    my @files = map { -d catdir($path,$_) ? catdir($path,$_)
        : catfile($path,$_) } sort +no_upwards readdir $dh;
    closedir $dh;
    
  2. or download this
    use Path::Class;
    my @files = dir($path)->children();
    # - or - 
    my @files = dir($path)->absolute->children();