Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

readdir

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.

Synopsis

my $entry = readdir($dh);      # scalar: one entry
my @entries = readdir($dh);     # list: all remaining entries

See Also

opendir, closedir, rewinddir, glob