On 6/23/06, Mark Harris <[EMAIL PROTECTED]> wrote:

opendir(DS, $dirspec);

You should probably use the "... or die" idiom, in case the opendir
fails, much as you would with open.

while($fn = readdir(DS))
{
     if ( -d $fn)

The most common error when combining readdir() and the -x family of
filetests is here: The filetests are given a simple filename, so
they're looking in the current working directory, but the readdir() is
reading a directory handle which may be open on an arbitrary
directory. The result is that you're asking whether the current
directory has a directory with the name of an item from another
directory.

only . and .. are identified as directories, the other subfolders are not.

Check.

Hope this helps!

--Tom Phoenix
Stonehenge Perl Training

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to