Cari di Perl 
    Perl User Manual
Daftar Isi
(Sebelumnya) Force a scalar contextGet void vs scalar vs list con ... (Berikutnya)
Miscellaneous functions

Remove a variable or function definition

Daftar Isi

  • undef EXPR

  • 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:

    1. undef $foo;
    2. undef $bar{'blurfl'}; # Compare to: delete $bar{'blurfl'};
    3. undef @ary;
    4. undef %hash;
    5. undef &mysub;
    6. undef *xyz; # destroys $xyz, @xyz, %xyz, &xyz, etc.
    7. return (wantarray ? (undef, $errmsg) : undef) if $they_blew_it;
    8. select undef, undef, undef, 0.25;
    9. ($a, $b, undef, $c) = &foo; # Ignore third value returned

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

 
Source : perldoc.perl.org - Official documentation for the Perl programming language
Site maintained by Jon Allen (JJ)     See the project page for more details
Documentation maintained by the Perl 5 Porters
(Sebelumnya) Force a scalar contextGet void vs scalar vs list con ... (Berikutnya)