my @files = map { "$dir/$_" } grep { !/^\.{1,2}$/ && -f "$dir/$_" } @tmp; my @dirs = map { "$dir/$_" } grep { !/^\.{1,2}$/ && -d "$dir/$_" } @tmp;