!/^\./ and push @standir, "$_\n" while ($_ = readdir(DIR)) # or @standir = grep { !/^\./ } readdir(DIR); # doesn't append \n