in reply to Building an anonymous subroutine
____________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->(); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Building an anonymous function
by BorgCopyeditor (Friar) on Aug 11, 2002 at 06:19 UTC |