| Miscellaneous functionsRemove a variable or function definitionDaftar Isi - undef
Undefines the value of EXPR, which must be an lvalue. Use only on ascalar 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 orDBM list values, so don't do that; see delete. Always returns theundefined value. You can omit the EXPR, in which case nothing isundefined, but you still get an undefined value that you could, forinstance, return from a subroutine, assign to a variable, or pass as aparameter. Examples: - 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;
- ($a, $b, undef, $c) = &foo; # Ignore third value returned
Note that this is a unary operator, not a list operator. |
| |
|