http://qs321.pair.com?node_id=11115413

perlancar has asked for the wisdom of the Perl Monks concerning the following question:

A couple of questions on handling dotfiles with perl's glob(). Seems like bsd_glob() doesn't offer any special handling of dotfiles.

1. Is there an equivalent for "shopt -s dotglob"? Reading File::Glob indicates there isn't.

2. What would be the easiest to accomplish "listing all files/subdirectories including dotfiles/dotsubdirs but without the . and .." and "listing all dotfiles/dotsubdirs only, without the . and .."? I've given up on glob() for this and simply do something along the line of:

@all_files_including_dot = do { opendir my $dh, "."; grep { $_ ne '.' +&& $_ ne '..' } readdir $dh }; @all_dotfiles = do { opendir my $dh, "."; grep { $_ ne '.' && $_ ne '. +.' && /\A\./ } readdir $dh };