in reply to Why can't I readdir multiple times in a while loop?
opendir(MYDIR, $dirname); while (condition) #condition ~ 1, loop basically forever { my @mail = grep { $_ ne '.' and $_ ne '..' } readdir MYDIR; foreach (@mail) { # do stuff # delete each file } undef(@mail); # @mail shuld be empty now rewinddir( MYDIR ); # so rewind the directory sleep(1); # give cpu a break } # more stuff... closedir(MYDIR);
tomy @mail = grep { $_ ne '.' and $_ ne '..' } readdir INDIR;
my @mail = grep { $_ ne '.' and $_ ne '..' } readdir MYDIR;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(Guildenstern ) REx2: Why can't I readdir multiple times in a while loop?
by Guildenstern (Deacon) on Aug 24, 2000 at 22:54 UTC |