perl-5.38.0
mkdir FILENAME,MODE
mkdir FILENAME
mkdir

Creates the directory specified by FILENAME, with permissions specified by MODE (as modified by umask). If it succeeds it returns true; otherwise it returns false and sets $! (errno). MODE defaults to 0777 if omitted, and FILENAME defaults to $_ if omitted.

FILENAME で指定したディレクトリを、MODE で指定した許可モード(を umask で修正したもの) で作成します。 成功時には真を返します; さもなければ偽を返して $! (errno) を設定します。 MODE を省略すると、0777 とみなし、 FILENAME を省略すると、$_ を使います。

In general, it is better to create directories with a permissive MODE and let the user modify that with their umask than it is to supply a restrictive MODE and give the user no way to be more permissive. The exceptions to this rule are when the file or directory should be kept private (mail files, for instance). The documentation for umask discusses the choice of MODE in more detail. If bits in MODE other than the permission bits are set, the result may be implementation defined, per POSIX 1003.1-2008.

一般的に、制限された MODE を使ってユーザーがより寛容にする方法を 与えないより、寛容な MODE でディレクトリを作り、ユーザーが自身の umask で修正するようにした方がよいです。 例外は、(例えばメールファイルのような)プライベートに保つべきファイルや ディレクトリを書く場合です。 umask の文書で、MODE の選択に関して詳細に議論しています。 MODE の中の許可モードビット以外のビットを設定した場合、 結果は POSIX 1003.1-2008 のように実装依存です。

Note that according to the POSIX 1003.1-1996 the FILENAME may have any number of trailing slashes. Some operating and filesystems do not get this right, so Perl automatically removes all trailing slashes to keep everyone happy.

POSIX 1003.1-1996 によれば、FILENAME には末尾に任意の数のスラッシュを つけることができます。 このようには動かない OS やファイルシステムもあるので、Perl はみんなが 幸せになれるように、自動的に末尾のスラッシュを削除します。

To recursively create a directory structure, look at the make_path function of the File::Path module.

ディレクトリ構造を再帰的に作成するには、File::Path モジュールの make_path 関数を 参照してください。