Beefy Boxes and Bandwidth Generously Provided by pair Networks httptech
We don't bite newbies here... much
 
PerlMonks  

perlfunc:undef

by gods
on Aug 24, 1999 at 22:42 UTC ( #271=perlfunc: print w/ replies, xml ) Need Help??

undef

See the current Perl documentation for undef.

Here is our local, out-dated (pre-5.6) version:


undef - remove a variable or function definition



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 the delete manpage.) 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;
    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.


Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (7)
As of 2014-04-17 22:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (458 votes), past polls