Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Answer: undef vs. $foo = 0

( #164337=categorized answer: print w/ replies, xml ) Need Help??

Q&A > input and output > undef vs. $foo = 0 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).

Comment on Answer: undef vs. $foo = 0
Select or Download Code
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 exploiting the Monastery: (4)
As of 2015-07-05 16:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (67 votes), past polls