--- name: readdir status: documented runtime: pp source: src/runtime/pp/directory.rs --- ```{index} single: readdir; Perl built-in (pp runtime) ``` # readdir ## Synopsis ```perl my $entry = readdir($dh); # scalar: one entry my @entries = readdir($dh); # list: all remaining entries ``` ## Description Reads entries from an open directory handle. In **scalar context**, returns the next directory entry name as a string, or `undef` when the directory is exhausted. In **list context**, returns all remaining entries as a list of strings. Entry names are bare filenames (no path prefix). The entries `.` and `..` are included, matching perl5 behavior. ## See also opendir, closedir, rewinddir, glob