Free Perl Tutorials

PERL opendir Function

"opendir" opens a directory on your computer using PERL. Here is an example of the proper usage of the opendir function:

opendir(DIRECTORY/FOLDER HANDLE, 'directory/folder name');

Think of the DIRECTORY/FOLDER HANDLE just as you would a FILE HANDLE, it acts similar to a variable that you can call on request in the remainder of your script. In a real world example, the example above would probably look something like this:

opendir(DIR, 'test');

Naturally, you would also want to close the folder or directory, so the coding for that would be:

closedir(DIR);

Hope this helps!