use File::Find; sub get_subdirs { my ($dir,$skip_match) = @_; # i can't figure how to pass $skip_match?? so that it could be used # inside the anonymous sub invoked by find(). my @dirs = find(sub { (my ($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_)) && -d _; }, $dir); \@dirs; }