in reply to Re^2: Confused scoping while using File::Find
in thread Confused scoping while using File::Find

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.

  • Comment on Re^3: Confused scoping while using File::Find

Replies are listed 'Best First'.
Re^4: Confused scoping while using File::Find
by rongoral (Beadle) on Oct 12, 2004 at 13:02 UTC

    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.