perl-5.38.0
reset EXPR
reset

Generally used in a continue block at the end of a loop to clear variables and reset m?pattern? searches so that they work again. The expression is interpreted as a list of single characters (hyphens allowed for ranges). All variables (scalars, arrays, and hashes) in the current package beginning with one of those letters are reset to their pristine state. If the expression is omitted, one-match searches (m?pattern?) are reset to match again. Only resets variables or searches in the current package. Always returns 1. Examples:

通常、ループの最後に、変数をクリアし、m?pattern? 検索を再び動作するように リセットするため、continue ブロックで使われます。 EXPR は、文字を並べたもの (範囲を指定するのに、ハイフンが使えます) と 解釈されます。 名前がその文字のいずれかで始まる、現在のパッケージの全ての変数 (スカラ、配列、ハッシュ)は、 最初の状態にリセットされます。 EXPR を省略すると、1 回検索 (m?pattern?) を再びマッチするように リセットできます。 カレントパッケージの変数もしくは検索だけがリセットされます。 常に 1 を返します。 例:

    reset 'X';      # reset all X variables
    reset 'a-z';    # reset lower case variables
    reset;          # just reset m?one-time? searches

Resetting "A-Z" is not recommended because you'll wipe out your @ARGV and @INC arrays and your %ENV hash.

reset "A-Z" とすると、@ARGV, @INC 配列や %ENV ハッシュも なくなってしまうので、止めた方が良いでしょう。

Resets only package variables; lexical variables are unaffected, but they clean themselves up on scope exit anyway, so you'll probably want to use them instead. See my.

パッケージ変数だけがリセットされます; レキシカル変数は影響を受けませんが、 スコープから外れれば自動的に綺麗になるので、これからはこちらを 使うようにした方がよいでしょう。 my を参照してください。