Functional Programming in Perl: Part 2
Lets take a look on closures:-
Need of closures:
Since closures are subroutine references with a bit of private data thrown in, they are very convenient to use as callback procedures in graphical user interfaces. There is a nice example which explains the need of using closures. This commonly used approach is called “smart” callback procedure.
For more info you can read chap 4 of Advanced Perl Programming by **Sriram Srinivasan.