Next Advanced Programming Techniques Slide #34

Closures

        sub make_function {
          my $val = shift;
          return sub { print "Value is $val.\n"; ++$val };
        }
        my $f1 = make_function(3);
        my $f2 = make_function(20);



Next Copyright © 2000 M-J. Dominus