#! perl -slw use strict; { package Foo; sub new{ bless {}, $_[ 0 ]; } sub DESTROY{ print "destroying $_[0]" } } if( my $x = Foo->new ) { print "Created $x"; } print "After first if"; if( my $x = Foo->new and 0 ) { print "Created $x"; } else{ print "Created $x but failed the if"; } print "After second if/else"; { if( my $x = Foo->new ) { print "Created $x"; } print "After third if"; } print "exited block"; __END__ P:\test>test Created Foo=HASH(0x22501c) After first if Created Foo=HASH(0x225028) but failed the if After second if/else Created Foo=HASH(0x225040) After third if destroying Foo=HASH(0x225040) exited block destroying Foo=HASH(0x225028) destroying Foo=HASH(0x22501c)