Hi,
I need to count how many directors are in so I decided to put the following code:
$root = $ENV{'DOCUMENT_ROOT'};
$basedir = "$root/cgi-bin/users";
opendir(DIR, "$basedir"
;
@members = readdir(DIR);
closedir(DIR);
$count = 0;
foreach $stuff (@members) {
$count++;
}
print "There are <b>$count</b> dirs inside the user dir.";
But i'm getting the value 5. I know why i'm getting it but don't know how to fix it. Inside the directory users, there are actually 3 dirs. The reason i'm getting the value 5 is because it's adding the "cgi-bin/users" and the other 3 dirs inside the users. But I only need to count the dirs that inside the directory "users". Any ideas how to fix this?
-Aaron
I need to count how many directors are in so I decided to put the following code:
$root = $ENV{'DOCUMENT_ROOT'};
$basedir = "$root/cgi-bin/users";
opendir(DIR, "$basedir"

@members = readdir(DIR);
closedir(DIR);
$count = 0;
foreach $stuff (@members) {
$count++;
}
print "There are <b>$count</b> dirs inside the user dir.";
But i'm getting the value 5. I know why i'm getting it but don't know how to fix it. Inside the directory users, there are actually 3 dirs. The reason i'm getting the value 5 is because it's adding the "cgi-bin/users" and the other 3 dirs inside the users. But I only need to count the dirs that inside the directory "users". Any ideas how to fix this?
-Aaron