Getting a Directory Listing
The first step in obtaining directory information from your system is to create a directory handle. A directory handle is something like a filehandle—except that instead of reading a filehandle to get the file's contents, you use a directory handle to read the contents of a directory. To open a directory handle, you use the opendir function:
opendir dirhandle, directory
In this syntax, dirhandle is the directory handle you want to open and directory is the name of the directory you want to read. If the directory handle cannot be opened—you don't have permission to read the directory, the directory doesn't exist, and so on—the opendir function returns false. Directory handles should be constructed similarly to filehandles—using ...
Get Sams Teach Yourself Perl in 24 Hours now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.