in reply to Re: GOTO or not GOTO
in thread GOTO or not GOTO
Is the compiler "smart enough" to know that I exited the loop and therefore the memory allocated to $j can now be reclaimed?
Perl doesn't reclaim lexicals, it just clears them. And yes, $j gets cleared.
sub DESTROY { print("DESTROYED\n"); } for ( my $i = 0; $i < 10; $i++ ) { my $j = bless({}); if ( $i == 0 ) { goto newlocation; } } newlocation: print( "jumped out" );
DESTROYED jumped out
|
---|