Since you declare @args as a lexical outside of the loop and the data structure before the loop, the closures aren't closed over the @args you think they are. :)
I'd pass @res to your data structure, but I'm paranoid about passing backref variables directly. It bit me in Regex::English or Test::MockObject at least once.
In reply to Re: Using $1,$2 etc in closures..
by chromatic
in thread Using $1,$2 etc in closures..
by castaway
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |