____________sub template { my $e = shift; my $not_common_a = $e eq 'b' ? sub { ... } : $e eq 'u' ? sub { ... } : sub { ... } ; my $not_common_b = $e eq 'x' ? sub { ... } : sub { ... } ; return sub { $common_stuff; $not_common_a->(); $more_common_stuff; $not_common_b->(); } }
In reply to Re: Closures
by Aristotle
in thread Building an anonymous subroutine
by BorgCopyeditor
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |