perl-5.40.0
local EXPR

You really probably want to be using my instead, because local isn't what most people think of as "local". See "Private Variables via my()" in perlsub for details.

あなたはが本当に望んでいるのは my の方でしょう; local はほとんどの人々が「ローカル」と考えるものと 違うからです。 詳しくは "Private Variables via my()" in perlsub を参照してください。

A local modifies the listed variables to be local to the enclosing block, file, or eval. If more than one value is listed, the list must be placed in parentheses. See "Temporary Values via local()" in perlsub for details, including issues with tied arrays and hashes.

"local" はリストアップされた変数を、囲っているブロック、 ファイル、eval の中で、ローカルなものにします。 複数の値を指定する場合は、リストはかっこで囲まなければなりません。 tie した配列とハッシュに関する事項を含む詳細については "Temporary Values via local()" in perlsub を参照してください。

Like my, state, and our, local can operate on a variable anywhere it appears in an expression (aside from interpolation in strings). Unlike the other declarations, the effect of local happens at runtime, and so it will apply to additional uses of the same variable executed after the declaration, even within the same statement. Note that this does not include uses within an expression assigned to the variable when it is localized, because the assigned expression is evaluated before the localization.

mystate、および our と同様に、local は、 (文字列内の補間を除いて)式内の任意の場所で変数を操作できます。 他の宣言とは異なり、local の効果は実行時に発生するため、 同じステートメント内であっても、宣言後に実行される同じ変数の追加の 使用に適用されます。 これには、変数がローカライズされるときに変数に割り当てられた 式の中での使用は含まれないことに注意してください。 割り当てられた式はローカライズの前に評価されるからです。 (TBR)

    package main;
    our $x = 2;
    {
      foo($x, local $x = $x + 1, $x); # foo() receives (2, 3, 3)
      # $main::x is 3 within the call to foo()
    }
    foo($x); # foo() receives (2) and $main::x is 2

The delete local EXPR construct can also be used to localize the deletion of array/hash elements to the current block. See "Localized deletion of elements of composite types" in perlsub.

delete local EXPR 構文は、配列/ハッシュの要素の削除を現在の ブロックにローカル化するためにも使われていました。 "Localized deletion of elements of composite types" in perlsub を 参照してください。