perl-5.38.0
undef EXPR
undef

Undefines the value of EXPR, which must be an lvalue. Use only on a scalar value, an array (using @), a hash (using %), a subroutine (using &), or a typeglob (using *). Saying undef $hash{$key} will probably not do what you expect on most predefined variables or DBM list values, so don't do that; see delete. Always returns the undefined value. You can omit the EXPR, in which case nothing is undefined, but you still get an undefined value that you could, for instance, return from a subroutine, assign to a variable, or pass as a parameter. Examples:

左辺値である EXPR の値を未定義にします。 スカラ値、(@ を使った)配列、(% を使った)ハッシュ、(& を使った) サブルーチン、(* を使った)型グロブだけに使用します。 特殊変数や DBM リスト値に undef $hash{$key} などとしても おそらく期待通りの結果にはなりませんから、しないでください; delete を参照してください。 常に未定義値を返します。 EXPR は省略することができ、その場合には何も未定義にされませんが 未定義値は返されますので、それをたとえば、 サブルーチンの返り値、変数への割り当て、引数などとして使うことができます。 例:

    undef $foo;
    undef $bar{'blurfl'};      # Compare to: delete $bar{'blurfl'};
    undef @ary;
    undef %hash;
    undef &mysub;
    undef *xyz;       # destroys $xyz, @xyz, %xyz, &xyz, etc.
    return (wantarray ? (undef, $errmsg) : undef) if $they_blew_it;
    select undef, undef, undef, 0.25;
    my ($x, $y, undef, $z) = foo();    # Ignore third value returned

Note that this is a unary operator, not a list operator.

これはリスト演算子ではなく、単項演算子であることに注意してください。