Perl: get hidden files

I was working on linux, it was a script that used to move and extract some files. Some of the files were hidden files(started with a dot(.))

If you use glob() function from Perl, it will not return those files. You have to relay on other functions. Like below one.


use File::Glob qw( bsd_glob );
my @files = ( bsd_glob("$dir/.*"), bsd_glob("$dir/*") );


If you use this one, at array @files, you'll have your all hidden and non hidden files in it.

Comments