On 9/22/05, $Bill Luebkert <[EMAIL PROTECTED]> wrote:

> >       opendir DIR, $from;
> >       my @entries = readdir DIR;

I believe that opening a new directory closes the old
directory handle, just like opening a new file closes
the old file handle, that used to be on that handle name.

The important thing is to read all the entries from
the directory before recursing, because as soon as you
recurse, the directory handle will get replaced with
the one from the inner direrctory.  So the C<my> on
   my @entries = readdir DIR
is the important part.  It has to be my, not our, otherwise
the deeper instances won't get their own.

adding closedirs makes it clearer, but shouldn't be required, and
yes the closedir belongs BEFORE the recursion, otherwise we'd
be closing a closed dirhandle many times on the way out.  There's
only one dirhandle in the code under discussion.

Good morning!



--
David L Nicol
this document can be opened in any word processor, including LyX

_______________________________________________
Perl-Win32-Admin mailing list
Perl-Win32-Admin@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to