Perl Home
PERL Functions
© 2011 TutorialsPoint.COM
|
PERL opendir Function
Syntax
Definition and Usage
Opens the directory EXPR, associating it with DIRHANDLE for processing, using the readdir function
Return Value
0 on failure
0 on failure
Example
Try out following example:
#!/usr/bin/perl -w
$dirname = "/tmp";
opendir ( DIR, $dirname ) || die "Error in opening dir $dirname\n";
while( ($filename = readdir(DIR))){
print("$filename\n");
}
closedir(DIR);
|
It will produce following results:
|

|
|
|