Did you chdir to the directory?  Otherwise your script might be checking the
wrong directory.

opendir(DIR,"/mydir");
@array = readdir(DIR);
chdir "/mydir";
foreach $dup (@array){
    (-d  $dup) ? print "yes: $dup  \n": print "no:  $dup \n";
}

-----Original Message-----
From: david wright [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 04, 2002 5:51 PM
To: [EMAIL PROTECTED]
Subject: file test doesn't seem to be working


i am sending @array a directory (i.e. example /usr/dw5) which contains a 
lot of files and folders (directories).
(i have already checked the value of @array and $dup and they are as 
desired.) What i want to accomplish is: print yes, "$dup (file name)" if 
it's a directory (folder) i am testing it on a directory which is 
composed of 90% folders. The example below will only print yes for . 
and .. and "no" for everything else. I have tried it with other file 
test's (i.e. -f, -A, -e, etc,...) none of them work as desired,... maybe 
i can't use the ternary operator like this? (damn waste if not) thanks.

foreach $dup (@array){
    (-d  $dup) ? print "yes: $dup  \n": print "no:  $dup \n";
)


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--------------------------------------------------------------------------------
This email may contain confidential and privileged 
material for the sole use of the intended recipient. 
If you are not the intended recipient, please contact 
the sender and delete all copies.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to