ディレクトリを開く
opendir は、EXPR に指定されたディレクトリを開き、ディレクトリハンドルを生成し、
DIRHANDLE にそのディレクトリハンドルをセットします。
このディレクトリハンドルは、readdir, telldir,
seekdir, rewinddir,
closedir で処理されます。
opendir は成功すれば真を返します。
opendir my $dh, './sample' or die 'Failed to open the directory.';
my @files = readdir $dh;
print join( "\n", @files ), "\n";