http://qs321.pair.com?node_id=267306


in reply to Re: Scoping issues with code evaluation asserstions?
in thread Scoping issues with code evaluation asserstions?

That was my first thought, but it didn't make much sense to me. Maybe my understanding of scoping isn't quite as good as I thought, but I thought that you had to declare a variable outside of the scope of the sub in order to create a closure.

Could it be that the one-time compilation of the regex somehow causes the closure?

Also, saying local $ret = ''; breaks under strict:

Variable "$ret" is not imported at /home/apirkle/bin/retest.pl line 8. Global symbol "$ret" requires explicit package name at /home/apirkle/b +in/retest.pl line 6. Global symbol "$ret" requires explicit package name at /home/apirkle/b +in/retest.pl line 8.