chdir "/home/www"; opendir DIR, "."; my @vhosts= ( # 1. This tests for the presence of directories grep { -d } ( # 2. this returns all directories but . & .. grep { !/^\.\.?$/ && -d } (readdir DIR) ) ); closedir DIR;