in reply to Bizarre Results when Creating a Closure

Thanks to all who replied.

I think merlyn may have said it best:  "It binds to the variable $i, not the current value."

And of course, I knew that ... but somehow wasn't comprehending why my closure didn't DWIM, and just use the current value of $i each time through the loop.

So now I'll just remember the rule:  "a closure binds to the variable, NOT to its value", and I should be all set.


s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/