use File::Glob ':glob'; my @dirs = grep { -d } bsd_glob('/usr/darren/' . $some_magic_globstr_here, GLOB_ERR); die "glob: $!" if GLOB_ERROR;