in reply to reading all files in a dir

my @dots = grep { /^\./ } readdir(DIR);

That finds all the files beginning with a . in your directory. You forgot to invert the regex for your grep. What you probably want is:

my @not_dots = grep { !/^\./ } readdir(DIR);

Then @not_dots will contain all the non-dotfiles.