I am trying to create an iterative subroutine of the anonymous local type. e.g.
my $anon = sub { my $count = shift; if ($count--) { print "Iterating\n"; $anon->($count); } };
The problem is that the $anon within the scope of the subroutine does not appear to relate to the original $anon variable declaration. I can get around this my going global, but that all appears a little messy for my liking !
Is there a way I can get around this ? Perhaps some clever curly braces somewhere ?
Thanks in advance....In reply to Iterative anonymous subroutines by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |