undef - remove a variable or function definition


undef EXPR



Undefines the value of EXPR, which must be an lvalue. Use on only a scalar value, an entire array or hash, or a subroutine name (using ``&''). (Using undef will probably not do what you expect on most predefined variables or DBM list values, so don't do that.) 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:

    undef $foo;
    undef $bar{'blurfl'};             # Compare to: delete $bar{'blurfl'};
    undef @ary;
    undef %hash;
    undef &mysub;
    return (wantarray ? () : undef) if $they_blew_it;
    select undef, undef, undef, 0.25;
    ($a, $b, undef, $c) = &foo;       # Ignore third value returned