use File::Glob qw(:globally); print join "\n", map {-d $_ ? $_ : ()} glob ('c:/foo/{*,.*}');