perl list of directories

How can I get the list of directories?

I basically need to execute script2 for each directory so that my script ends up executing the following commands:

perl dir1
perl dir2
perl dir3
# here is how i'm attempting to get the list of directories however this is recursive and I only want # the list of directories in the specified
# i tried setting  no_chdir to 0 but it didn't help
my @folders;
find sub{
	push @folders, "$File::Find::name" if (-d $File::Find::name);

Open in new window

Who is Participating?
@folders = grep -d,<*>; #is a list of folders in the current directory
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.