perl-5.38.0
opendir DIRHANDLE,EXPR

Opens a directory named EXPR for processing by readdir, telldir, seekdir, rewinddir, and closedir. Returns true if successful. DIRHANDLE may be an expression whose value can be used as an indirect dirhandle, usually the real dirhandle name. If DIRHANDLE is an undefined scalar variable (or array or hash element), the variable is assigned a reference to a new anonymous dirhandle; that is, it's autovivified. Dirhandles are the same objects as filehandles; an I/O object can only be open as one of these handle types at once.

readdirtelldirseekdirrewinddirclosedir で処理するために、EXPR で指定された名前の ディレクトリをオープンします。 成功時には真を返します。 DIRHANDLE は間接ディレクトリハンドルとして使える値(普通は実際のディレクトリ ハンドルの名前)となる式でも構いません。 DIRHANDLE が未定義のスカラ値(または配列かハッシュの要素)の場合、その変数は 新しい無名ディレクトリハンドルへのリファレンスが代入されます; つまり、 自動有効化されます。 ディレクトリハンドルはファイルハンドルと同じオブジェクトです; 一つの I/O オブジェクトは同時にこれらのハンドル型のどちらかとしてのみ 開くことができます。

See the example at readdir.

readdir の例を参照してください。