in reply to "readdir() attempted on invalid dirhandle" error?
Anyway, the answer you're looking for is perldoc -f opendir. This corresponds to the C library opendir/readdir/seekdir/telldir/rewinddir/scandir/closedir family of functions which operate on a DIR* struct, which is very different from a file handle. I think the error message tries to convey that with "dirhandle" language instead of "filehandle".
Meanwhile, I recommend Path::Tiny or Path::Class is you're doing any significant amount of work with browsing file trees. If you can't use modules, there's also the handy 'glob' function with the convenient built-in syntax of my @files= <$dir/*>; Note that that one returns full relative paths instead of just the file names, which is sometimes more useful (and sometimes not).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: "readdir() attempted on invalid dirhandle" error?
by choroba (Cardinal) on Jul 10, 2024 at 21:35 UTC | |
by parv (Parson) on Jul 10, 2024 at 21:47 UTC | |
|
Re^2: "readdir() attempted on invalid dirhandle" error?
by parv (Parson) on Jul 10, 2024 at 21:12 UTC | |
|
Re^2: "readdir() attempted on invalid dirhandle" error?
by Anonymous Monk on Jul 10, 2024 at 20:39 UTC | |
by hv (Prior) on Jul 10, 2024 at 22:30 UTC | |
by ikegami (Patriarch) on Jul 11, 2024 at 13:45 UTC | |
by ikegami (Patriarch) on Jul 11, 2024 at 13:56 UTC |