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.