|
|
| Do you know where your variables are? | |
| PerlMonks |
Re^3: 'Dynamic scoping' of capture variables ($1, $2, etc.)by LanX (Saint) |
| on Dec 16, 2012 at 22:48 UTC ( [id://1009098]=note: print w/replies, xml ) | Need Help?? |
|
You are right be worried, your example code is just a bit to complex to make it evident at first glance. There is no logical reason why nested calls of the same function (i.e. recursions) should act differently to nested calls of different functions. see updated code, especially the second paragraph contrasting the bug.
Cheers Rolf UPDATE: to be sure to avoid any side effects from eval within the debugger here a standalone file for testing:
UPDATE: Best practice is to copy captures like $1 ASAP! (not only in recursions)
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||