http://www.perlmonks.org?node_id=984769

uday_sagar has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks,

I think this is one of already asked questions!

I want the script to list all the directories that are at some depth which will be specified by the user.

The code I have is finding all the directories recursively. I want only at a particular level.

use Cwd; use File::Find; my $dir = getcwd; find(\&print_name_if_dir, "$dir"); sub print_name_if_dir { if (-d) { print $_."\n"; } }

Thanks