Replace "sub {" with "do { my $sub; $sub = sub {" and add a "}" on the end. Then inside of the sub, $sub will be a reference to the sub:
do { my $sub; $sub = sub { print "I am $sub\n"; } }->();
- tye
In reply to Re: Reference to an anon sub from within. (do my...)
by tye
in thread Reference to an anon sub from within.
by Dedalus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |