Will the memory used by the anonymous subroutine created as shown below, be returned 
to the memory
pool when the variable holding the reference to the anonymous subroutine goes out of 
scope when the
program returns from fooBar.

$widget->fooBar( $condition );

sub fooBar {

        my ( $widget, $condition ) = @_;

        my $input;
        my $anonymous  = sub {  print "$input\n" }:

        if ( $condition == 0 ) {

            $input = "Hey y'all";
            &$anonymous;
        } elsif ( $condition == 1 ) {

            $input = "See ya later";
            &$anonymous;
    } elsif ( $condition == 2 ) {

            $input = "Think I'll stay awhile."
            &$anonymous;
    }
}


C. Echols


_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to