It is quite usual for a new comer to the Perl world being confused by closure, so don't be too frustrated ;-)
Closure is something nice to know, so you can recognize it next time. But in general, you should avoid it, as it breaks your lexical scope. You want to code in a clear way, not a confusing way ;-) I guess you learned more than just closure, if you think about it more.
| [reply] |
Indeed, I have learned a lesson. A cool one though. I was not sure what a closure was. It is kind of a difficult concept. However, I now see why my variable maintained its value even after the surrounding function had returned and the scope was lost.
I am grateful for the knowledge passed along.
| [reply] |