http://www.perlmonks.org?node_id=267276


in reply to Scoping issues with code evaluation asserstions?

It seems you have inadvertently created a closure.

If you use local $ret = ''; in that sub, things should work.

Note, however, that by "work" I don't mean that it will return "1.1.1.1.1." It will only return 1 when the ^(a) portion of the regex matches. That's because, if it doesn't match, the regex engine returns right away and never gets to your code assertion.

-sauoq
"My two cents aren't worth a dime.";