use File::Find; sub get_sub_dirs { my @return; find sub { push @return, $File::Find::name if -d; }, @_; @return; }