Other alternatives have been shown elsewhere in this thread, but one that Perlmonks uses (for reasons that are not worth getting into) is to do
local *foo= sub { my ($param)= @_; do { something }; foo($param); }; foo(...);
This approach has the nice benefit of benefit of being a touch more readable and avoids the memory leak when using the lexically scoped var variant (as ambrus mentions elsewhere). On the other hand it spoils the method cache which can cause a general slowdown for OO. YMMV.
In reply to Re: private recursive subroutines
by demerphq
in thread private recursive subroutines
by Sixtease
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |