my $which_site = shift @ARGV or die "Usage: $0 \n"; my $home = "/home/sites/$which_site/users"; use Cwd; my $old_cwd = cwd(); # keep current working directory chdir $home or die "Can't chdir: $!\n"; opendir(HOME, '.') or die "Can't opendir: $!\n"; my @users = grep { !/^\./ # skip any .file_or_dir esp . and .. and -d # is it a directory? } readdir(HOME); closedir(HOME); # go back to where we started chdir $old_cwd or die "Can't chdir: $!\n"; print join "\n", @users, '';