in reply to Re^2: Bizarre Results when Creating a Closure
in thread Bizarre Results when Creating a Closure

True, and perhaps I should have been a little clearer...

The coderef in question is being used as a callback for a PerlTk widget, and a documented way to do closures for widget callbacks is to pass a reference to a list consisting of a coderef an anonymous sub as the first parameter followed by arguments.

Reference "perldoc Tk::callbacks" or (Google) Tk::callbacks site:cpan.org

Did you try actually running the code with the modification I proposed? It works exactly as expected.

  • Comment on Re^3: Bizarre Results when Creating a Closure