Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Answer: undef vs. $foo = 0

by Mur (Pilgrim)
on May 06, 2002 at 14:29 UTC ( #164337=categorized answer: print w/replies, xml ) Need Help??

Q&A > input and output > undef vs. $foo = 0 - Answer contributed by Mur

undef $bar may have some useful side-effects, if $bar is an object.
$bar = Foo->new(); ... undef $bar;
will invoke "Foo::DESTROY", if it is defined.
$bar = 0;
will also invoke DESTROY, but not if '0' is a valid assignment in the "Foo" class (long shot, I know).

Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2017-06-26 07:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (573 votes). Check out past polls.