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

Re^4: if(my) scope

by ig (Vicar)
on Apr 16, 2009 at 22:23 UTC ( #758087=note: print w/replies, xml ) Need Help??


in reply to Re^3: if(my) scope
in thread if(my) scope

case in point:

package H; sub DESTROY { print "DESTROY\n"; } sub new { my $class = shift; bless {}, $class; } { if(my $h = H->new()) { print "IN\n"; undef $h; } print "\$h out of scope\n"; } print "why now?\n";

produces:

IN DESTROY $h out of scope why now?

As does:

package H; sub DESTROY { print "DESTROY\n"; } sub new { my $class = shift; bless {}, $class; } { { if(my $h = H->new()) { print "IN\n"; } } print "\$h out of scope\n"; } print "why now?\n";

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://758087]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2017-11-19 01:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (278 votes). Check out past polls.

    Notices?